micropython / micropython-lib

Core Python libraries ported to MicroPython

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

suggestion: add brightness to neopixel library

tmountjr opened this issue · comments

Not sure if this is the best place to do this but I thought I'd take a stab at this. The default build includes a NeoPixel library which is great, but the brightness on those things is enough to land an airliner at night, and yet there's no included way in the library to manage the brightness. On the C++ side, you can do this:

pixels.setBrightness(newBrightness);

where newBrightness is a value from 0 to 255. CircuitPython is a bit easier, you just do this:

pixels.brightness = 0.25

where the value you put in is a float between 0 and 1 (for 100%). But in both cases, setting that value recalculates the new values for each color bit and optionally redraws the string depending on if you have it set that way or not.

Would it be worth adding some basic brightness control to the existing library? Would I create a PR against this repo or against one somewhere else?

Created a PR to address this: #739