Neopixel brightness?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Strik3r
Posts: 15
Joined: Thu Nov 28, 2019 7:36 pm
Location: Saratov, Russia

Neopixel brightness?

Post by Strik3r » Sat Feb 08, 2020 2:24 pm

Is there any way to control brightness of ledlights with oficial neopixel driver? Or mb some forks of it exists (besides LoBoris port)?
Thanks

Strik3r
Posts: 15
Joined: Thu Nov 28, 2019 7:36 pm
Location: Saratov, Russia

Re: Neopixel brightness?

Post by Strik3r » Sat Feb 08, 2020 8:47 pm

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)

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Neopixel brightness?

Post by scruss » Sat Mar 12, 2022 10:34 pm

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.

Post Reply