I a looking for an example of CRGB array.  How would I define a

I a looking for an example of CRGB array. How would I define a new array called newArray of an existing array of leds starting at position 6 and length 10?

I saw come comments on-line but I don’t recall any examples.

Are you asking about CRGBSet or something different? Can you provide more info about what you’re trying to setup?

CRGBSet info:

Simple example:

Maybe this example code will help:

Nice example thanks. More elegant than my way.

Will this work?? Objective is to have an array (without indexing) . In this example, I can change attributes of “beginning” array without have use the index .

CRGBArray<NUM_LEDS> leds;
CRGB beginning [10];
CRGB middle [10];
CRGB end [10];

beginning = leds(1,10);
middle = leds(11,20);
end = leds(21,30);

beginning = CRGB::Black;
middle = CRGB::Red;
end = CRGB:: Black;

CRGBArray<NUM_LEDS> leds;
CRGBset beginning(leds(1,10)); //set custom ranges
CRGBset middle(leds(11,20));
CRGBset end(leds(21,30));

CRGB colorBeginning(0,0,0); //give names to colors
CRGB colorMiddle(255,0,0);
CRGB colorEnd = CRGB::Black;

Then in the main loop you can do something like:

beginning = colorBeginning;
middle = colorMiddle;
end = colorEnd;
FastLED.show();

thank you Marc. This is exactly the code I was looking for.

OK, one more question. I have a long string the has six of beginning, middle and ends. so two questions

  1. how to define beg, mid, end as a 6 deep CRGBArray?
  2. how to reference one index of the array.

I get a little confused since CRGB isn’t a true array but a pointer back to the original array. So I need “an array of a pointer array of the original Leds array”.

Here is what I am guessing:

// how do I define CRBGArray as an array?
CRGBArray<NUM_LEDS> leds; //??

// is this the method for indexing a single element of CRGBArray

CRGBset beginning1; //set custom ranges
CRGBset middle1;
CRGBset end1;

CRGB colorBeginning(0,0,0); //give names to colors
CRGB colorMiddle(255,0,0);
CRGB colorEnd = CRGB::Black;

Then in the main loop you can do something like:

beginning[1] = colorBeginning;
middle[1] = colorMiddle;
end[1] = colorEnd;
FastLED.show();