Simple question I think.

Simple question I think. What is the best way to tell if some pixel is at half brightness? I have a simple nightlight in my daughter’s room that currently just blinks an LED ring from Adafruit, one pixel on showing through a globe with stars painted on it. Neat little lit moving star field on the ceiling. However, I’d like to do something where I light one for a few seconds, and then dim it rather quickly but start to brighten another when I’ve dimmed the pixel by say 50%.

I’ve thought about doing this with CHSV, where the idea is pretty simple, but there aren’t enough colors I think. The nightlight doesn’t work well with darker colors like red and orange. So, the CRGB gamut is where I want to be because I can do all sorts of bright colors. But, I can’t tell when a color is roughly halfway dimmed so I can start the next one.

Anyone have any easy way to do this? Thoughts?

There’s getLuma and also getAverageLight which might help.
pixelLuma = leds[i].getLuma();
pixelAverage = leds[i].getAverage();

Hmm, interesting. I may try that. Thanks.

Also, if you know you’re darkening it by a fixed amount each loop or iteration, then you would know that after x number of loops or iterations you would have reached that 50% or lower value and it’s time to trigger lighting up another pixel.