Skip to content

Instantly share code, notes, and snippets.

@chemdoc77
Created January 25, 2017 04:03
Show Gist options
  • Save chemdoc77/25d8b91d28f37c87aaadcd9ff02f8c78 to your computer and use it in GitHub Desktop.
Save chemdoc77/25d8b91d28f37c87aaadcd9ff02f8c78 to your computer and use it in GitHub Desktop.
Testing FastLED's CRGBSet array function and using it in an array of CRGBSET arrays
// Testing the CRGBSet array function and using it in an array of CRGBSET arrays
//by Chemdoc77
#include "FastLED.h"
#define NUM_LEDS 24
#define Data_Pin 6
#define chipset NEOPIXEL
#define BRIGHTNESS 50
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 * ledsarray[] ={leds1, leds2, leds3};
void setup() {
delay(2000); // power-up safety delay
FastLED.addLeds<chipset, Data_Pin>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.setMaxPowerInVoltsAndMilliamps(5,1500);
set_max_power_indicator_LED(13);
}
void loop() {
for (uint8_t x=0; x<3; x++){
for (uint8_t y=0; y<8; y++){
if (y<4){
ledsarray[x][y]=CRGB::Red;
}
else
{ledsarray[x][y]=CRGB::Blue;
}
FastLED.show();
delay(200);
ledsarray[x][y]=CRGB::Black;
FastLED.show();
}
}
}
@smacks999
Copy link

smacks999 commented Aug 21, 2022

Hi. Just stumbled across this wile searching for something very similar. I know this is more than few years old, but hopefully this rings your doorbell.

Can an array be set up as you describe, and then apply an effect to array1, and a different effect to array2, Both to load with a button push?
I have the effects built as a function [ void xx() ] Can I have an effect such as "twinkle" assigned to group1, and in another void function, a second, different effect on group, say, 3?
The main sketch will call these functions with a button push. Also a button to change one of them and then another press to turn off.

Thanks.
Jim Smagata

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment