Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Testing the CRGBSet array function and using it with the fill_solid function.
- // by Chemdoc77
- #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));
- 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() {
- // fill the first array
- fill_solid(leds1, 8, CHSV( 213, 255, 255)); // note: 8 is the number of pixels in the array
- FastLED.show();
- delay(500);
- fill_solid( leds1, 8, CRGB::Black);
- FastLED.show();
- // fill the second array
- fill_solid(leds2, 8, CHSV( 96, 255, 255)); // note: 8 is the number of pixels in the array
- FastLED.show();
- delay(500);
- fill_solid( leds2, 8, CRGB::Black);
- FastLED.show();
- // fill the third array
- fill_solid(leds3, 8, CRGB::Red); // note: 8 is the number of pixels in the array
- FastLED.show();
- delay(500);
- fill_solid( leds3, 8, CRGB::Black);
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment