Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led = 11;
- int brightness = 0;
- int fade = 5;
- void setup() {
- // put your setup code here, to run once:
- pinMode(led, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- analogWrite(led, brightness);
- if(brightness == 0)
- delay(500);
- brightness = brightness + fade;
- if(brightness >= 255 || brightness <= 0)
- fade = -fade;
- Serial.println(brightness);
- delay(40);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement