I set up 2 arrays
uint8_t Array_Color[] = {0, 2, 4, 6, … 142};
uint8_t Array_White[] = {1, 3, 5, 7, … 143};
How can I use Array_Color properly to have only every second LED working with the demo reel examples including fill_rainbow and beatsin16 ?
Maybe with struct CRGB Color_LEDs … ??
Thank you!
What if you create three leds arrays:
CRGB leds[NUM_LEDS];
CRGB leds_Color[NUM_LEDS/2];
CRGB leds_White[NUM_LEDS/2];
Operate on leds_Color as normal with fill_rainbow, etc, and then make a function that copies those values to all the even pixels in leds. Similar for White copying to the odd pixels in leds. Then do show().
This uses up additional memory with the extra leds arrays but hopeful would get you going.
Hi @marmil thanks for responding. This is exactly my stumbling block:
how to make a function that copies those values to all even and then all odd numbers.
Memory is no problem, I’m using an ESP12 with 4M
Thank you @Daniel_Garcia I came up with almost the same formula but I failed to fill the numbers in CRGB leds_Color. @marmil 's suggestion had to be modified to
CRGB leds_Color[NUM_LEDS];
CRGB leds_White[NUM_LEDS];
because this formula already takes in account that there are only half of the pixels.
Put everything on pastebin and will create another post. http://pastebin.com/UbMAteSy
So - in there, you want the leds_Color and leds_White to be NUM_LEDS/2 - not NUM_LEDS. You’re only copying half of what’s in leds_Color and half of what’s in leds_White into leds - so you’re wasting memory here.
Alternatively, what would be better is:
// Define the number of RGB+WWW pixels #define NUM_LEDS 72
// Because each “pixel” is 6 bytes, it’s going to be two CRGB objects
CRGB leds[NUM_LEDS * 2];
CRGB leds_Color[NUM_LEDS];
CRGB leds_White[NUM_LEDS];
Then you can just use NUM_LEDS everywhere for your loops, and the for loop i gave you above would become:
for(int i = 0; i < NUM_LEDS; i++) { leds[i*2] = leds_Color[i]; leds[(i*2)+1] = leds_White[i]; }
Also - you will be happy to know that I’m beginning testing on code that gives you not only CRGB, but also CRGBW, and also CRGBWWW, and also CRGB16, etc… etc…
had today a presentation with direct comparison between APA104 and WS6812 (on NeoPixel-lib) - guess who is the winner.
This makes a BIG difference in interior lighting.