Grouping LED's in an RGB Strip

I would like to group certain LED's together for ease of programming but am having some difficulty. I'm a complete NEWB so any assistance would be appreciated. I've tried the following to group the RGB's:

int tree = {1, 2, 3,4};
int square = {4, 7, 13,14};
int box = {3,8,12,15}

and then in the code loop I've tried something like this to light them:

FastLED.show();
  delay(1000);
  FastLED.clear();


    led[tree].setRGB(255,0,0);

    FastLED.show();
    delay(20);
FastLED.clear();

led[box].setRGB(255,100,23);

This isn't working so I'm looking for some help. I basically want to light the defined square led's or tree led's and have them change color and timing without having to individually define the led's each cycle or have to run a "for" loop each time I want to light the particular defined led shape.

You can’t use an array of integers to index an array. You have to step through the array of indexes:

  FastLED.clear();

   for (int i=0; i<4; i++)
     led[tree[i]].setRGB(255,0,0);

    FastLED.show();

I’m a little confused, in your response above, what would be the point of even defining the “tree” if you had to define the array each time:

Isn’t the following:

FastLED.clear();

   for (int i=0; i<4; i++)
     led[tree[i]].setRGB(255,0,0);

    FastLED.show();

Just the same as:

FastLED.clear();

   for (int i=0; i<4; i++)
     led[i]setRGB(255,0,0);

    FastLED.show();

In other words, is defining the “tree” actually doing anything if I have to specify the “for” array for each led in the tree each time I want to light the tree?

So there is no way to light the “tree” without stepping through an array each time. For example, if I wanted the tree to be green for a few seconds and then white for a few seconds, would I have to do a “for” loop for each?

Diregard, I figured it out - the for "array" has to match the number of led's in the "tree" group for each light in that loop to light up.

Thanks for the help.

ericgrphone: …

So there is no way to light the "tree" without stepping through an array each time. For example, if I wanted the tree to be green for a few seconds and then white for a few seconds, would I have to do a "for" loop for each?

At some point, yes. This is where a function would be nice. You could pass it the "tree" thing and a color, or whatever, and its for loop would do the work.

Then your main code will not have for loops, rather call the function to exploit one for loop for any "tree" or "square" or other thing you define as you have.

a7