Last active
January 4, 2016 02:09
-
-
Save dwhacks/8553072 to your computer and use it in GitHub Desktop.
fade
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
/*Fade Up*/ | |
for(byte i=1; i<100; i++) { | |
byte on = i; | |
byte off = 100-on; | |
for( byte a=0; a<100; a++ ) { | |
digitalWrite(led, HIGH); | |
delayMicroseconds(on); | |
digitalWrite(led, LOW); | |
delayMicroseconds(off); | |
} | |
} | |
/*Fade Down*/ | |
for(byte i=1; i<100; i++) { | |
byte on = 100-i; | |
byte off = i; | |
for( byte a=0; a<100; a++ ) { | |
digitalWrite(led, HIGH); | |
delayMicroseconds(on); | |
digitalWrite(led, LOW); | |
delayMicroseconds(off); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment