Created
May 30, 2013 06:14
-
-
Save pastak/5675999 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #define LED1 6 | |
| #define LED2 10 | |
| int brightness[] = {0,10,20,30,40,50,60,70,80,90,100}; | |
| void setup(){ | |
| pinMode(LED1,OUTPUT); | |
| pinMode(LED2,OUTPUT); | |
| } | |
| void loop(){ | |
| for(int i = 0; i<11; i++){ | |
| int br = brightness[i]*255/100; | |
| analogWrite(LED1,br); | |
| analogWrite(LED2,255-br); | |
| delay(50); | |
| } | |
| for(int i = 10;i>-1;i--){ | |
| int br = brightness[i]; | |
| analogWrite(LED1,br); | |
| analogWrite(LED2,255-br); | |
| delay(100); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment