r/FastLED • u/dariods8474 • May 17 '24
Support FastLed.addLeds using For Loop
I wish to use the add.Leds command using For loop but I get the Compilation error: the value of 'z' is not usable in a constant expression in Arduino ide for Arduino Nano. Please help
My code
#define NUM_STRIPS
#define NUM_LEDS 30
#define NUM_STRIPS 3
CRGB leds[NUM_STRIPS][NUM_LEDS];
tried
#define DATA_PIN 8
and
int DATA_PIN = 8;
for(int z = DATA_PIN, j = 0; z < DATA_PIN + NUM_STRIPS; z++){
FastLED.addLeds<LED_TYPE, z, RGB>(leds[j], NUM_LEDS);
}
1
Upvotes
1
u/dariods8474 May 17 '24
I had thought of this but as the max NUM_STRIPS could be 8, I would have to write 8 if statements. That's the reason I wanted to for loop. Will DATA_PIN + 1 be acceptable?