Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <Adafruit_NeoPixel.h>
  2.  
  3. #define Count 90
  4. #define Pin 6
  5. Adafruit_NeoPixel strip = Adafruit_NeoPixel(Count,Pin,NEO_GRB + NEO_KHZ800);
  6.  
  7. #define Brightness 10 //Set brightness to 1/10th
  8. #define Full (255/Brightness)
  9. //Create scrolling red and white candy cane stripes.
  10. //Try adjusting the width in pixels for various results.
  11. //Value "sets" should evenly divide into strand length
  12. void CandyCane  (int sets,int width,int wait) {
  13.   int L;
  14.   for(int j=0;j<(sets*width);j++) {
  15.     for(int i=0;i< strip.numPixels();i++) {
  16.       L=strip.numPixels()-i-1;
  17.       if ( ((i+j) % (width*2) )<width)
  18.         strip.setPixelColor(L,Full,0,0);
  19.       else
  20.         strip.setPixelColor(L,Full,Full, Full);
  21.     };
  22.     strip.show();
  23.     delay(wait);
  24.   };
  25. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement