2015年1月16日 星期五

Week16


void setup(){
  //start serial connection
  Serial.begin(9600);
  //configure pin2 as an input and enable the internal pull-up resistor
  pinMode(2, INPUT_PULLUP);
  pinMode(13, OUTPUT); 
  int now=0;

}

void loop(){
  //read the pushbutton value into a variable
  int sensorVal = digitalRead(2);

  if (sensorVal == HIGH) {
    digitalWrite(13, LOW);
    
  } 
  else {
    digitalWrite(13, HIGH);
    Serial.write(65);
    delay(120);
  }
}

沒有留言:

張貼留言