Created
October 18, 2015 11:07
-
-
Save fjukstad/718203f2f292c4b90106 to your computer and use it in GitHub Desktop.
Simple spaceship interface. Project # 2 from the Arduino starterkit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int switchState = 0; | |
void setup() { | |
pinMode(3, OUTPUT); | |
pinMode(4, OUTPUT); | |
pinMode(5, OUTPUT); | |
pinMode(2, INPUT); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
switchState = digitalRead(2); | |
if(switchState == LOW){ | |
digitalWrite(3, HIGH); | |
digitalWrite(4, LOW); | |
digitalWrite(5, LOW); | |
} else { | |
digitalWrite(3, LOW); | |
digitalWrite(4, LOW); | |
digitalWrite(5, HIGH); | |
delay(250); | |
digitalWrite(4, HIGH); | |
digitalWrite(5, LOW); | |
delay(250); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment