Skip to content

Instantly share code, notes, and snippets.

Created December 2, 2013 06:26
Show Gist options
  • Save anonymous/7745878 to your computer and use it in GitHub Desktop.
Save anonymous/7745878 to your computer and use it in GitHub Desktop.
void setup(){
pinMode(2,INPUT);
pinMode(9,OUTPUT);
}
int last_sw;
void loop(){
int sw = digitalRead(2);
int light=0;
if(last_sw==LOW){
if(sw==HIGH){
if(digitalRead(9)==LOW){
digitalWrite(9,HIGH);
}
else{
digitalWrite(9,LOW);
}
light++;
}
}
if(light>=3){
digitalWrite(9,HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment