Advertisement
Guest User

WS2812B-V5 issues

a guest
Nov 12th, 2024
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. /// @file DemoReel100.ino
  2. /// @brief FastLED "100 lines of code" demo reel, showing off some effects
  3. /// @example DemoReel100.ino
  4.  
  5. #include <FastLED.h>
  6. #include "fx/1d/demoreel100.hpp"
  7.  
  8. #define DATA_PIN 38
  9. //#define CLK_PIN 4
  10. #define LED_TYPE WS2812B
  11. #define COLOR_ORDER RGB
  12. #define NUM_LEDS 8
  13. CRGB leds[NUM_LEDS];
  14.  
  15. #define BRIGHTNESS 16
  16. #define FRAMES_PER_SECOND 30
  17.  
  18. DemoReel100Ref demoReel = DemoReel100Ref::New(NUM_LEDS);
  19.  
  20. void setup() {
  21. delay(3000); // 3 second delay for recovery
  22.  
  23. // tell FastLED about the LED strip configuration
  24. FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip).setRgbw();
  25. //FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
  26.  
  27. // set master brightness control
  28. FastLED.setBrightness(BRIGHTNESS);
  29.  
  30. // Initialize the DemoReel100 instance
  31. demoReel->lazyInit();
  32. }
  33.  
  34. void loop()
  35. {
  36. // Run the DemoReel100 draw function
  37. demoReel->draw(Fx::DrawContext(millis(), leds));
  38.  
  39. // send the 'leds' array out to the actual LED strip
  40. FastLED.show();
  41. // insert a delay to keep the framerate modest
  42. FastLED.delay(1000/FRAMES_PER_SECOND);
  43. }
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement