I'm trying to create an array of color orders (to go along with an

I’m trying to create an array of color orders (to go along with an array of pin #'s), but I seem to be stumbling a bit. As I’m barely more than a novice with this language, my guess is that the answer is probably pretty obvious to anyone a bit more seasoned, so hopefully someone here can point me in the right direction … again. :slight_smile:

What I have is:
constexpr byte LED_PIN[] = { 14, 15, 16, 17, 18, 19 };
constexpr uint8_t COL_ORD[] = { GRB, RGB, GRB, GRB, GRB, GRB };
#define COLOR_ORDER GRB

and then in setup, line variant 1 works, but line 2 does not (which attempts to use COL_ORD):
1-> FastLED.addLeds<CHIPSET, LED_PIN[0], COLOR_ORDER>(leds[0], NUM_LEDS).setCorrection( TypicalLEDStrip );
2-> FastLED.addLeds<CHIPSET, LED_PIN[0], COL_ORD[0]>(leds[0], NUM_LEDS).setCorrection( TypicalLEDStrip );

Line 2 throws the error:
error: no matching function for call to 'CFastLED::addLeds(CRGB [60], int)

I’ve tried several datatypes for COL_ORD, but I feel like it might not be a datatype issue at all, and maybe I have to approach this from an entirely different angle.

As always, any insight is appreciated.
Thanks!

Try EOrder for your data type. See “pixeltypes.h” for an explanation

That worked … thanks! But that leads me to a follow up question, though I think its more general C++, however someone here might be able to explain it …

Along with those arrays, I’d like to run the FastLED.addLeds lines in a loop within setup() … for example:

for ( int i = 0; i < 6; i++ ){
FastLED.addLeds<CHIPSET, LED_PIN[i], COL_ORD[i]>(leds[i], NUM_LEDS).setCorrection( TypicalLEDStrip );
}

But this gives me a compile error about the fact that “the value of ‘i’ is not usable in a constant expression” … not that entering the lines individually is difficult; I’m just trying to simplify the portability because once this is done, I’ll be running the code on many controllers and the number of attached LED strips will vary.

Does anyone have a suggestion on this?, or is my only option to run it line by line?
Thanks again

I don’t understand what your trying to do.

When you setup your fastled controller you pass it a CRGB array.
That is and array of CRGB data type 1 for each pixel in the strip that this controller will be controlling. CRGB data type is just to hold 8 bit red/green/blue values.

Your trying to setup the controller with one CRGB from your array.

(I think)

I don’t have the code in front of me, but in this case, the ‘leds’ is a multi-dimensional array

CRGB leds[NUM_STRIPS][NUM_LEDS];

The loop iterates through whatever number of strips/pins are in use (a variable would replace the ‘6’ in the for loops condition, and the number could ultimately be controlled by a constant), and populates the second dimension as it goes. At least that’s what it’s supposed to do.

If I run the exact same setup line (1 or 10 times) and use the explicit values 1 through 10 (instead of substituting ‘i’) the code works just fine.

Does that make more sense? (I’m learning as I go, so I apologize if I’m lacking correct terminology)

That makes sense.
I’m interested in the answer, but i don’t know it.

There’s a lot of optimization going on that requires the pin number be 1) constant and 2) known at compile time. You might be able to do it with the pins defined const byte pin[] = {};