Is there a way to control the brightness in void addGlitter( fract8 chanceOfGlitter) ?

Is there a way to control the brightness in
void addGlitter( fract8 chanceOfGlitter) ?

I know I can set the overall brightness for a sketch, but I’d also like to set separate brightness for different voids and/or colors.

In this case, I’d like to remove fadeToBlackby from the glitter function and then use it to fill an entire strip by lighting random LEDs. My power supply can handle full bright red, but not full bright white – so it would be nice to be able to tweak the Values (V) settings.

Any thoughts or hints? Thanks!

Can you post your code to The addGlitter function, at least the one in the demoreel100 example, does not use a fadetoBlackBy.

Wait… I can use


Yes, that should work too.

I was going to use (part of) the code from here…

Ah, thank you for sharing some code!
If you don’t want any continuous fading, yes, you can remove line 23.
And then if you want your added “glitter” to not be as bright, on line 35, instead of CRGB::White use CHSV(0,0,128) or whatever brightness you’d like.

Also, you mentioned being able to set a different brightness for different functions. You can do it the same way as setting the brightness in setup(). In each function you could (re)set a different master brightness.

void functionA {
//do stuff…

void functionB {
//do stuff…

void functionC {
//do stuff…

void functionD {
//do stuff…

If you run function A it will set brightness to 64, and if you run function B it will set brightness to 90. functionC will again use whatever you set the BRIGHTNESS variable to at the top of your sketch. And functionD would be half of whatever the BRIGHTNESS variable is set to.

You guys are awesome! Thanks for the help @marmil !