Page 1 of 1

Neopixel brightness?

Posted: Sat Feb 08, 2020 2:24 pm
by Strik3r
Is there any way to control brightness of ledlights with oficial neopixel driver? Or mb some forks of it exists (besides LoBoris port)?
Thanks

Re: Neopixel brightness?

Posted: Sat Feb 08, 2020 8:47 pm
by Strik3r
Is it the right way, to change just brighness, but not colour:

Code: Select all

color = [128, 255, 128]
brightness = 5  # brighness in % (0-100)


def bri(pos):
    global brightness
    pos = round(pos/100*brightness)
    return pos


result = list(map(bri, color))
print(result)

Re: Neopixel brightness?

Posted: Sat Mar 12, 2022 10:34 pm
by scruss
Hey, I know you haven't been back on the site for years, but thanks for this. It works really well!

I've been using it with a smooth dimming curve to get very pleasing results:

Code: Select all

b = [round(100 * pow(sin(radians(x * 9 / 2)), 2)) for x in range(40)]
As long as the colour animation goes quickly, the small colour shifts caused by rounding aren't noticeable to me.

This is also really handy for stopping close-packed NeoPixel boards (Adafruit NeoPixel FeatherWing, I'm looking at you) from overheating.