chemdoc77

CRGBSet Array Function Test

Apr 27th, 2016
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. // Testing the CRGBSet array function and using it in an array of CRGBSET arrays
  2.  
  3. #include "FastLED.h"
  4. #define NUM_LEDS 24
  5.  
  6. #define Data_Pin 6
  7.  
  8. CRGB rawleds[NUM_LEDS];
  9. CRGBSet leds(rawleds, NUM_LEDS);
  10. CRGBSet leds1(leds(0,7));
  11. CRGBSet leds2(leds(8,15));
  12. CRGBSet leds3(leds(16,23));
  13. CRGBSet all(leds(0,23));
  14.  
  15. struct CRGB * ledsarry[] ={leds1, leds2, leds3};
  16.  
  17.  
  18. void setup() {
  19. delay(2000); // power-up safety delay
  20. FastLED.addLeds<NEOPIXEL, Data_Pin>(leds, NUM_LEDS);
  21. FastLED.setBrightness(50);
  22.  
  23. }
  24. void loop() {
  25.  
  26. for (uint8_t x=0; x<3; x++){
  27. for (uint8_t y=0; y<8; y++){
  28. if (y<4){
  29. ledsarry[x][y]=CRGB::Red;
  30. }
  31.  
  32. else
  33. {ledsarry[x][y]=CRGB::Blue;
  34. }
  35. FastLED.show();
  36. delay(200);
  37. ledsarry[x][y]=CRGB::Black;
  38. FastLED.show();
  39. }
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment