Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ledPin = 9;
- int brightness = 0;
- boolean increase_brightness = true;
- void setup(){
- pinMode(ledPin, OUTPUT);
- }
- void loop(){
- if(brightness == 64 && increase_brightness)
- {
- increase_brightness = false;
- } else if (brightness == 0 && !increase_brightness){
- increase_brightness = true;
- }
- if(increase_brightness)
- {
- brightness++;
- } else {
- brightness--;
- }
- analogWrite(ledPin, brightness);
- delay(30);
- }
Add Comment
Please, Sign In to add comment