2013年4月22日 星期一

week 9. arduino tutorial


basic sensors and movement

1. find basic movement qualities (LMA) and gestural movement patterns
2. implement these movements with sensors

4 則留言:

  1. 今日課程:
    軟體:windows下載32位元: http://processing.org

    硬體韌體開發工具(IDE):
    http://arduino.cc/en/Main/Software

    回覆刪除
  2. //begin

    const int buttonPin = 2; // the number of the pushbutton pin
    const int ledPin = 13; // the number of the LED pin
    int buttonState = 0; // variable for reading the pushbutton status
    void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    pinMode(buttonPin, INPUT);
    }

    void loop(){
    Serial.println("hi");
    delay(1000);
    buttonState = digitalRead(buttonPin);//1 HIGH 0 LOW
    if (buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);
    }
    else {
    digitalWrite(ledPin, LOW);
    }
    }

    //ending

    回覆刪除
  3. //processing begin final

    import processing.serial.*;
    Serial myPort; // Create object from Serial class
    void setup() {
    background(0);
    println(Serial.list());
    myPort = new Serial(this, "COM3", 9600);
    }
    void draw()
    {
    if (myPort.available()>0)
    {
    int rx = myPort.read();
    println(rx);
    if (rx == 104)
    {
    background(255, 0, 0);
    }
    if (rx == 105)
    {
    background(0, 0, 0);
    }
    }
    // background(255,0,0);
    }
    void mousePressed()
    {
    background(0);
    }

    void keyPressed()
    {
    background(255, 0, 0);
    }

    //ending

    回覆刪除
  4. //arduino final

    const int buttonPin = 2; // the number of the pushbutton pin
    const int ledPin = 13; // the number of the LED pin
    int buttonState = 0; // variable for reading the pushbutton status
    void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    pinMode(buttonPin, INPUT);
    }

    void loop(){

    buttonState = digitalRead(buttonPin);//1 HIGH 0 LOW
    if (buttonState == HIGH) {
    Serial.println("h");
    delay(1000);
    digitalWrite(ledPin, HIGH);
    }
    else {
    Serial.println("i");
    delay(1000);
    digitalWrite(ledPin, LOW);
    }
    }


    //ending

    回覆刪除