Created
August 13, 2015 12:03
-
-
Save pjflanagan/9bbfbc90178ad9bf0866 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
const int in = 1, | |
out = 3; | |
boolean on = false, | |
switchable = true; | |
void setup() { | |
pinMode(in, INPUT); | |
pinMode(out,OUTPUT); | |
} | |
void loop(){ | |
if(digitalRead(in)==LOW && switchable == true){ | |
if(on)on = false; | |
else on = true; | |
switchable = false; | |
if(on) analogWrite(out,200); | |
else analogWrite(out,0); | |
} | |
else if(digitalRead(in)==HIGH){ | |
switchable = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read about the project here