TrickLED - NeoPixel WS2812B Animation Library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
sgar
Posts: 11
Joined: Sat May 01, 2021 1:14 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by sgar » Fri May 21, 2021 7:18 am

Primesty wrote:
Sun May 16, 2021 9:40 pm
Hi Sgar,

Thanks, I’ll give that a shot.
Any luck with this? :)

Primesty
Posts: 49
Joined: Sun Jun 28, 2020 11:06 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by Primesty » Sun May 23, 2021 4:27 pm

Any luck with this?
Hi Sgar, YES that worked! I first downgraded to MP 1.14 and tried everything. I might have put all the files in the /lib sub_dir instead of giving trickLED its own sub-dir on the ESP32. Now the demo file runs without a hitch also on MP 1.15.

Thanks a lot:)

sgar
Posts: 11
Joined: Sat May 01, 2021 1:14 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by sgar » Mon May 24, 2021 3:39 pm

Primesty wrote:
Sun May 23, 2021 4:27 pm
Any luck with this?
Hi Sgar, YES that worked! I first downgraded to MP 1.14 and tried everything. I might have put all the files in the /lib sub_dir instead of giving trickLED its own sub-dir on the ESP32. Now the demo file runs without a hitch also on MP 1.15.

Thanks a lot:)
Nice! If you achieve to change the brightness in animations please share! :lol:

Primesty
Posts: 49
Joined: Sun Jun 28, 2020 11:06 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by Primesty » Mon May 24, 2021 3:44 pm

Nice! If you achieve to change the brightness in animations please share! :lol:
Will do! :)

Primesty
Posts: 49
Joined: Sun Jun 28, 2020 11:06 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by Primesty » Fri Sep 17, 2021 8:35 pm

Hi @sgar,

You might have figured this out already, but there is a global brightness setting in the trickLED.py file, which you might be able to manipulate:

Code: Select all

global_setings = {
    'brightness': 200,
    'interval': 60,
    'palette': None,
    'animation': None
}
The various animation functions also all have brightness setting, which you might be able to manipulate.

Code: Select all

class AnimationBase:
    """ Animation base class. """

    def __init__(self, leds, interval=50, palette=None, generator=None, brightness=200, **kwargs):
        """
        :param leds: TrickLED object
        :param interval: millisecond pause between each frame
        :param palette: color palette
        :param generator: color generator
        :param brightness: set brightness 0-255
        :param kwargs: additional keywords will be saved to self.settings
        """

Since
MappedAnimationBase
seems to inherit from
AnimationBase
and Fire, in turn, inherits from
MappedAnimationBase
you might be able to feed the brightness parameter into it.

Maybe that helps

markvanpraet
Posts: 1
Joined: Mon Dec 27, 2021 8:43 pm

Re: TrickLED - NeoPixel WS2812B Animation Library

Post by markvanpraet » Mon Dec 27, 2021 8:52 pm

Not sure if it's appropriate to reply on this post, but I believe that MP 1.17 has introduced an issue. While working well at MP 1.15, when the demo is loaded and run under 1.17 it throws an error:

Demonstrating animations press CTRL+C to cancel... or wait about 2 minutes.
LitBits settings: default
Traceback (most recent call last):
File "<stdin>", line 181, in <module>
File "<stdin>", line 51, in demo_animations
File "<stdin>", line 39, in play
File "neopixel.py", line 1, in fill
TypeError: 'int' object isn't subscriptable

I am using Thonny on an ESP32 (NodeMCU).

There's just too much functionality to sacrifice in the rewrite of my principal code to remain at 1.15, so I'll have to live without animations and generators for now (sadly).

If there's any further info I can provide, please let me know.

Post Reply