Advertisement
Guest User

Untitled

a guest
Oct 12th, 2020
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. // Relaxing Slow and Smooth scrolling christmas colors to hang in my tree
  4.  
  5. #define LED_PIN 5
  6. #define NUM_LEDS 60
  7. #define BRIGHTNESS 128
  8. CRGB leds[NUM_LEDS];
  9.  
  10. static const byte hue_arr[6]= {0,64,96,0,64,96};
  11. static const byte sat_arr[6]= {255,150,255,255,150,255};
  12.  
  13. word w;
  14.  
  15. void setup() {
  16. delay( 3000 ); // power-up safety delay
  17. FastLED.addLeds<NEOPIXEL,LED_PIN>(leds, NUM_LEDS);
  18. FastLED.setBrightness(BRIGHTNESS);
  19. FastLED.setDither(0); // flickers if adding a lot of leds
  20. }
  21.  
  22. void loop() {
  23. EVERY_N_MILLIS(10) {
  24. FastLED.show();
  25. }
  26. EVERY_N_MILLIS(10) {
  27. w++;
  28. if (w>768) w=0;
  29. byte p=0;
  30. for(byte i=0;i<NUM_LEDS;i++) {
  31. p++;
  32. if (p>23) p=0;
  33. leds[i]=CHSV(hue_arr[((w>>5)+p)>>3],sat_arr[((w>>5)+p)>>3],sin8((i<<5)+w-32));
  34. leds[i]+=leds[i];
  35. }
  36. }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement