Guest User

Untitled

a guest
May 12th, 2022
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #include <FastLED.h>
  2. #define LED_TYPE WS2812B // type of RGB LED's
  3. #define COLOR_ORDER GRB // sequence of color
  4. #define NUM_LEDS 300 // # of LED's
  5. #define LED_PIN 2 // data pin on Arduino
  6. #define BRIGHTNESS 200 // brightness range [0-255]
  7.  
  8. CRGB leds[NUM_LEDS]; // array for RGB control
  9.  
  10. void setup()
  11. {
  12. FastLED.setMaxRefreshRate(0);
  13. FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); // initializing definitions
  14. FastLED.setBrightness(BRIGHTNESS); // intializing brightness
  15. }
  16.  
  17. void loop()
  18. {
  19. CRGB TurnOnColor = CRGB::Blue; // setting desired color
  20. CRGB TurnOffColor = CRGB::Black; // turning off LED
  21. int i; // intializing counter
  22. int StripLength = 60; // Length of the chasing strip
  23.  
  24. for (i = 0; i < StripLength; i++)
  25. {
  26. leds[i] = TurnOnColor;
  27. FastLED.show();
  28. }
  29.  
  30. for (i = StripLength; i < NUM_LEDS; i++)
  31. {
  32. leds[i] = TurnOnColor;
  33. leds[i-StripLength] = TurnOffColor;
  34. FastLED.show();
  35. }
  36. for(i = NUM_LEDS-StripLength; i <NUM_LEDS; i++)
  37. {
  38. leds[i] = TurnOffColor;
  39. FastLED.show();
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment