Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Testing the CRGBSet array function and using it in an array of CRGBSET arrays
- #include "FastLED.h"
- #define NUM_LEDS 24
- #define Data_Pin 6
- CRGB rawleds[NUM_LEDS];
- CRGBSet leds(rawleds, NUM_LEDS);
- CRGBSet leds1(leds(0,7));
- CRGBSet leds2(leds(8,15));
- CRGBSet leds3(leds(16,23));
- CRGBSet all(leds(0,23));
- struct CRGB * ledsarry[] ={leds1, leds2, leds3};
- void setup() {
- delay(2000); // power-up safety delay
- FastLED.addLeds<NEOPIXEL, Data_Pin>(leds, NUM_LEDS);
- FastLED.setBrightness(50);
- }
- void loop() {
- for (uint8_t x=0; x<3; x++){
- for (uint8_t y=0; y<8; y++){
- if (y<4){
- ledsarry[x][y]=CRGB::Red;
- }
- else
- {ledsarry[x][y]=CRGB::Blue;
- }
- FastLED.show();
- delay(200);
- ledsarry[x][y]=CRGB::Black;
- FastLED.show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment