Local Dimming Question: I have 4 arrays of 120 LEDS all running nicely in

Local Dimming Question: I have 4 arrays of 120 LEDS all running nicely in my front windows. They currently do a rather bland Christmas Tree light type of display (randomly blinking different colors). However, I’d like to expand that and make random pixels in each array slightly brigthen, then dim, and return to the original brightness as a new color. I have been trying to use the Anti-aliased example to do this, but can’t quite figure out how to get an RGB color from the pixel in question into HSV so I can use that code? The other dimming functions all take arrays all take arrays of pixels. Two thoughts I had.

  1. Is it possible to have a non linear array of pixels that I can send to fadeToBlackBy()? And if it is, how would I use this or another function to brighten to max first, and then dim to black? is there a penalty to sending these functions a single pixel array? I assume they don’t return until the operation is complete, so this isn’t likely what I want to do.
  2. How could I modify the anti-alias example to do this? I think that actually might be a better way to do it, but I don’t see how to translate so I can query the set color first and then do my little display.

Thanks for any help.

Note, I just saw Mark’s holiday lights example. I think I can use that to do pretty much what I want. Thanks for that Mark. It’s pretty cool you did it so efficiently.

Happy to share the code and the light!

As for a multi-colored version of this code, there are a lot of ways to skin the proverbial cat.

The least-weird way is that along side your
CRGB leds[NUM_LEDS];
array, you also declare an array of HSV colors, one for each led, like this
CHSV pixelColor[NUM_LEDS];

Then you do all your animation in the pixelColor array, and each time just before you call FastLED.show(), you do this:
hsv2rgb_rainbow( pixelColor, leds, NUM_LEDS);
FastLED.show();
This will convert all your pixelColor’s into RGB values in the leds array, and then display them.

The problem is that this takes up exactly twice as much RAM as just keeping RGB values around, and you may not have that much RAM. Probably don’t in fact.

Another way to to it is to have a separate, smaller array of “which pixels am I animating right now”, and for each of those pixels, keep information like what the new target hue is, what the current brightness is, whether you’re still brightening the old color or fading in a new color, etc. This takes way less RAM, but needs more code (and thinking).

There are, of course, lots of other ways to do it, too, but at this point I’d recommend playing around a bit and see what you come up with.