Guest User

Untitled

a guest
Oct 21st, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. /* Fading an LED in and out to produce a glow effect
  2. via the PWM pins.
  3. */
  4.  
  5. int timer = 10;
  6. int pin = 3;
  7. int val = 0;
  8.  
  9. void setup(){
  10. pinMode(pin, OUTPUT);
  11. }
  12.  
  13. void loop(){
  14. while (val <= 220) {
  15. analogWrite(pin, val);
  16. val++;
  17. delay(timer);
  18. }
  19. while (val >= 30) {
  20. analogWrite(pin, val);
  21. val--;
  22. delay(timer);
  23. }
  24. }
Add Comment
Please, Sign In to add comment