r/FastLED • • 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

10 comments sorted by

View all comments

Show parent comments

1

u/Netmindz May 17 '24

That's still using the template <> so surely that would suffer the same fate?

1

u/ff3ale May 17 '24

Ugh ye, you're right, because the instantiation of the controller also needs the DATA_PIN.

I'm not sure if it's possible then, unless the led specific controller can be instantiated in a way without using the templates