TrickLED - NeoPixel WS2812B Animation Library
TrickLED - NeoPixel WS2812B Animation Library
Hey folks. I've been lurking here for a while and wanted to make my introduction with a small gift for you fine people.
I've been working on an animation library for MicroPython. There's no reason the Arduino folks should have all of the fun!
I wrote if for the ESP32 but it runs fine on an ESP8266 if you use the *.mpy files instead. I put a demo video up on Youtube here https://www.youtube.com/watch?v=vLvrJPNvkvU
But the colors didn't come across at all on the video, so load up a copy onto your board and see it live.
https://gitlab.com/scottrbailey/trickLED
Shout out to Peter Hinch. Even though you didn't know it, you were immensely helpful. Thanks for your contributions to the community.
Artacus
I've been working on an animation library for MicroPython. There's no reason the Arduino folks should have all of the fun!
I wrote if for the ESP32 but it runs fine on an ESP8266 if you use the *.mpy files instead. I put a demo video up on Youtube here https://www.youtube.com/watch?v=vLvrJPNvkvU
But the colors didn't come across at all on the video, so load up a copy onto your board and see it live.
https://gitlab.com/scottrbailey/trickLED
Shout out to Peter Hinch. Even though you didn't know it, you were immensely helpful. Thanks for your contributions to the community.
Artacus
Re: TrickLED - NeoPixel WS2812B Animation Library
Hi Artacus!
This library is fantastic! Thanks a lot for this!
I have one question though. I'm trying to run your example on an ESP32 with MicroPython 1.15 and am getting import errors.
I have, as well as and installed and this is your example code I'm trying to run to get started:
Two things are basically happening: 1) When I run the code without the animations/generators import, I get an error about function arguments:
And 2) when I'm trying to import generators/animations, I get this error (for both and also individually):
What am I doing wrong here? I assume there might be some circular dependency issue? Also, would you be willing to share the code for the animations/examples in your Youtube video?
This library is fantastic! Thanks a lot for this!
I have one question though. I'm trying to run your example on an ESP32 with MicroPython 1.15 and am getting import errors.
I have
Code: Select all
trickLED.py
Code: Select all
animations.py
Code: Select all
generators.py
Code: Select all
from machine import Pin
import machine
import uasyncio as asyncio
import trickLED
from trickLED import animations
from trickLED import generators
# use TrickLED class instead of NeoPixel
tl = trickLED.TrickLED(machine.Pin(19), 4)
tl.fill((50, 50, 50), start_pos=0, end_pos=2) # fill first 25 pixels with white
tl.fill_gradient(0xDC143C, 0xF08080, 3) # fill remaining with red gradient
tl.write()
Code: Select all
Traceback (most recent call last):
File "main.py", line 11, in <module>
TypeError: unexpected keyword argument 'start_pos'
MicroPython v1.15 on 2021-04-18; ESP32 module with ESP32
Type "help()" for more information.
Code: Select all
Traceback (most recent call last):
File "main.py", line 5, in <module>
ImportError: can't import name animations
MicroPython v1.15 on 2021-04-18; ESP32 module with ESP32
Type "help()" for more information.
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: TrickLED - NeoPixel WS2812B Animation Library
You probably need to copy the whole trickLED directory with its content to your ESP32 board's flash. Not just the *.py files in it.
Re: TrickLED - NeoPixel WS2812B Animation Library
Awesome library! Congratulations!
I will try to use it in my project Thanks!!
I will try to use it in my project Thanks!!
Re: TrickLED - NeoPixel WS2812B Animation Library
@Spotlightkid, good thought! I tried that but it threw the same error.
Does anyone have any setup instructions and examples that run reliably on MicroPython 1.15 and an ESP32??
Does anyone have any setup instructions and examples that run reliably on MicroPython 1.15 and an ESP32??
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: TrickLED - NeoPixel WS2812B Animation Library
I had a look at the trickLED code and I can't see how you would get the errors you get if you have the package installed correctly on your board.
I would take these steps to install the library:
Code: Select all
rshell rm -r /pyboard/trickLED
rshell mkdir /pyboard/trickLED
for py in trickLED/*.py; do
mpy-cross "$py"
done
rshell cp trickLED/*.mpy /pyboard/trickLED
Re: TrickLED - NeoPixel WS2812B Animation Library
@artacus any chance to configure brightness in Fire animation and/or flip the direction of the animations? (Fire start from last led)
Thanks!
Thanks!
Re: TrickLED - NeoPixel WS2812B Animation Library
@sgar
Do you mind posting your sample code or a link to a repo with the code you’re running? Are you using an ESP32? How did you install the trickLED lib?
I tried installing the entire folder, but am still getting an error.
Do you mind posting your sample code or a link to a repo with the code you’re running? Are you using an ESP32? How did you install the trickLED lib?
I tried installing the entire folder, but am still getting an error.
Re: TrickLED - NeoPixel WS2812B Animation Library
No worries :
I'm running the main.py demo from the library with the folow lines modified:
Line 170: Changed the pin where I have connected the leds.
Line 176: Commented, to avoid any wifi connection
Running with Thonny, ESP32, only copied the .py files and it works well, here you can see the setup.
https://i.ibb.co/yNvZGzS/14-05-2021-10-54-53-REC.png
Re: TrickLED - NeoPixel WS2812B Animation Library
Hi Sgar,
Thanks, I’ll give that a shot.
Thanks, I’ll give that a shot.