2015年1月6日 星期二

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);
  }
}



沒有留言:

張貼留言