Created
November 24, 2016 15:05
-
-
Save wakasann/86177dc08eceb9b5f3d363e7cae9f4e8 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
int brightness =0; //defined the int var brightness and set the init value,it is use to show the led light | |
int fadeAmount = 5; //defined int var fadeAmount,it use to set the light add/mins count | |
void setup() | |
{ | |
pinMode(9,OUTPUT); //set the prot 9 is output port | |
} | |
void loop() | |
{ | |
analogWrite(9,brightness); // set the port 9 use brightness | |
brightness = brightness + fadeAmount; //change the brightness value,make led light can next loop change | |
if(brightness == 0 || brightness == 255){ | |
fadeAmount = -fadeAmount; //make the light can high or low | |
} | |
delay(30); //delay 30 seconds | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment