Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Fading an LED in and out to produce a glow effect
- via the PWM pins.
- */
- int timer = 10;
- int pin = 3;
- int val = 0;
- void setup(){
- pinMode(pin, OUTPUT);
- }
- void loop(){
- while (val <= 220) {
- analogWrite(pin, val);
- val++;
- delay(timer);
- }
- while (val >= 30) {
- analogWrite(pin, val);
- val--;
- delay(timer);
- }
- }
Add Comment
Please, Sign In to add comment