daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define PIN 11      // control pin
  2. #define DELAY 10    // 20ms internal delay; increase for slower fades
  3.  
  4. void setup() {
  5.   pinMode(PIN, OUTPUT);
  6. }
  7.  
  8. void loop() {
  9.   // fade in
  10.   for(int i=0; i<255; i++) {
  11.     analogWrite(PIN, i);
  12.     delay(DELAY);
  13.   }
  14.  
  15.   // fade out
  16.   for(int i=0; i<255; i++) {
  17.     analogWrite(PIN, 255-i);
  18.     delay(DELAY);
  19.   }
  20. }
RAW Paste Data
Top