Created
December 2, 2013 06:26
-
-
Save anonymous/7745878 to your computer and use it in GitHub Desktop.
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
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