Guest User

Untitled

a guest
Dec 15th, 2025
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. #define NUM_LEDS 100
  4. #define LED_DATA_PIN 3
  5. #define BRIGHTNESS 255
  6. #define UPDATES_PER_SECOND 60
  7.  
  8. CRGB leds[NUM_LEDS];
  9.  
  10. // Animation attributes
  11. CRGBPalette16 currentPalette = RainbowColors_p;
  12. TBlendType currentBlending = LINEARBLEND;
  13. uint8_t startIndex = 0;
  14.  
  15. void setup()
  16. {
  17. FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
  18. FastLED.setBrightness(BRIGHTNESS);
  19. }
  20.  
  21. void loop()
  22. {
  23. startIndex++;
  24.  
  25. uint8_t colorIndex = startIndex;
  26. for(int i = 0; i < NUM_LEDS; i++) {
  27. leds[i] = ColorFromPalette(currentPalette, colorIndex, BRIGHTNESS, currentBlending);
  28. colorIndex += 3;
  29. }
  30.  
  31. FastLED.delay(1000 / UPDATES_PER_SECOND);
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment