Thanks, so there would be no conflict using that method twice - once in a function that populates leds EVERY_N_SECONDS from a palette, and then in another function that does random brightness manipulation with it? There is no generic
@Andreas_Hopf
“…so there would be no conflict using that method twice - once in a function that populates leds EVERY_N_SECONDS from a palette, and then in another function…”
It’s fine to do something like that. You can (re)assign values to a pixel as much/often as you like. You must call FastLED.show() to send the new data to the strip and actually see the change though.
I need to specify h and s also, but I can’t know what they are.
The colours are set independently for all 144 LEDs by a function that EVERY_N_MINUTES fetches a new colour from a palette, which works very well on its own.
The other function EVERY_N_MILLISECONDS, similar to the @Mark_Kriegsman example, randomly darkens/brightens LEDs with a state flag, and that also works very well on its own.
In other words, the second function needs, apart from the random LED selection stuff, to simply manipulate just the v component of certain LEDs, if you see what I mean. So in the end I have in the loop
ultraslowPalette(); - goes through a palette over an hour fairlyFastTwinkle(); - darkens/brightens random LEDs quickly
doSomethingElse();
FastLED.show();
also in the fairlyFastTwinkle() function, I would interfere with the other function that with a different timing already fetches colours from the palette.
@Jason_Coon Cheers, but “Yeah, except setVal and setSat only work on HSV, not RGB” - that would exactly be what I want, sounds just right. So I understand you saying these methods do exist? This approximate stuff seems quite cumbersome just to change V, compared to how simple changing the H leds[i].setHue(#); is.
Those methods exist, but only for CHSV, not CRGB. Your leds array is CRGB. The only way to get from CRGB to CHSV is rgb2hsv_approximate. Or you could just store the CHSV in a separate array, as noted above.
one can only work with RGB methods, if one is no coding wizard with rgb2hsv_approximate and wants to keep it simple; so that means in my case, being no coding wizard, I best use
leds[i].addToRGB(#);
leds[i].subtractFromRGB(#);
to darken/brighten leds array elements that are constantly filled by extrapolation from a palette.