chemdoc77

Using fill_solid with CRGBSet arrays

Apr 28th, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. // Testing the CRGBSet array function and using it with the fill_solid function.
  2. // by Chemdoc77
  3.  
  4. #include "FastLED.h"
  5. #define NUM_LEDS 24
  6.  
  7. #define Data_Pin 6
  8.  
  9. CRGB rawleds[NUM_LEDS];
  10. CRGBSet leds(rawleds, NUM_LEDS);
  11. CRGBSet leds1(leds(0,7));
  12. CRGBSet leds2(leds(8,15));
  13. CRGBSet leds3(leds(16,23));
  14.  
  15. struct CRGB * ledsarry[] ={leds1, leds2, leds3};
  16.  
  17. void setup() {
  18. delay(2000); // power-up safety delay
  19. FastLED.addLeds<NEOPIXEL, Data_Pin>(leds, NUM_LEDS);
  20. FastLED.setBrightness(50);
  21.  
  22. }
  23. void loop() {
  24.  
  25. // fill the first array
  26. fill_solid(leds1, 8, CHSV( 213, 255, 255)); // note: 8 is the number of pixels in the array
  27. FastLED.show();
  28. delay(500);
  29. fill_solid( leds1, 8, CRGB::Black);
  30. FastLED.show();
  31.  
  32. // fill the second array
  33. fill_solid(leds2, 8, CHSV( 96, 255, 255)); // note: 8 is the number of pixels in the array
  34. FastLED.show();
  35. delay(500);
  36. fill_solid( leds2, 8, CRGB::Black);
  37. FastLED.show();
  38.  
  39. // fill the third array
  40. fill_solid(leds3, 8, CRGB::Red); // note: 8 is the number of pixels in the array
  41. FastLED.show();
  42. delay(500);
  43. fill_solid( leds3, 8, CRGB::Black);
  44. FastLED.show();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment