Neopixel Change Brightness While Running a Animation

I'm using the Neopixel library from jgarff to control my Neopixel LED strips and I want to change the brightness while a animation is running.

In the library I'm using there isn't a command to refresh the brightness, but there is a command that initializes the LED strip.

strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)

I've tried using Multithreading a making a loop which reinitializes the LED strip every 50ms and then changing the LED_BRIGHTNESS variable, but then the animation weren't smooth and only reinitializing the LED_BRIGHTNESS variable gives me an error.

Does somebody have an idea how I could solve this problem?

I'm thankfully for any answers.

2
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article