Skip to content

Instantly share code, notes, and snippets.

@lazytomatolab
Created April 30, 2017 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazytomatolab/e603a3939fbf8b438c43ac8760d8bef8 to your computer and use it in GitHub Desktop.
Save lazytomatolab/e603a3939fbf8b438c43ac8760d8bef8 to your computer and use it in GitHub Desktop.
【Arduino SpeedUp】快速上手 Class 8 - 互動?遊戲?按鈕特輯!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
pinMode(7, INPUT);
digitalWrite(7, HIGH);
pinMode(13, OUTPUT);
}
void loop() {
if(digitalRead(7) != HIGH){
digitalWrite(13, HIGH);
}
else{
digitalWrite(13, LOW);
}
}
boolean state = false;
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
pinMode(7, INPUT);
digitalWrite(7, HIGH);
}
void loop() {
if(digitalRead(7) != HIGH){
state = !state;
digitalWrite(13, state);
delay(200);
}
else{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment