Skip to content

Instantly share code, notes, and snippets.

@MargenauMaker
Last active October 15, 2019 05:28
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 MargenauMaker/06dffc5370fe9a616a0eb2001d41e469 to your computer and use it in GitHub Desktop.
Save MargenauMaker/06dffc5370fe9a616a0eb2001d41e469 to your computer and use it in GitHub Desktop.
/* Basic if else example for Lilymini
*written by B. Elliott Oct 15, 2019
*/
int switchState = 0;
void setup() {
pinMode (7, OUTPUT);
pinMode (5, OUTPUT);
pinMode (4, OUTPUT);
pinMode (2, INPUT);
}
void loop() {
switchState = digitalRead(2);
if (switchState == LOW){
digitalWrite (4, HIGH);
digitalWrite (5,LOW);
digitalWrite (7,LOW);
}
else{
digitalWrite (4, LOW);
digitalWrite (5,HIGH);
digitalWrite (7,HIGH);
delay (250);
digitalWrite (4, HIGH);
digitalWrite (5,LOW);
digitalWrite (7,LOW);
delay(250);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment