Hi folks, I’ve been fumbling around with this for a while, and finally decided it’s worth asking for help.
I’m trying to run animations directly a Python script and failing miserably. While it seems that Projects are the preferred approach with Bibliopixel 3.0, I’m struggling to make REST and Controls work the way I’d like.
I’m running a string of WS2812 from a Raspberry Pi and a PiPixel hat. A simple project illuminates the LED’s, as does a direct call to myStrip.set(i,color) - so I’m confident that wiring isn’t the issue.
This project file works great:
driver:
typename: pi_ws281x
gpio: 18
num: 10
animation:
typename: BiblioPixelAnimations.strip.ColorWipe.ColorWipe
Enter code here…
``
The Python script that doesn’t work is here:
import bibliopixel
from bibliopixel import Strip
from bibliopixel.drivers.PiWS281X import PiWS281X, ChannelOrder
import bibliopixel.colors as colors
import time
import random
bibliopixel.log.setLogLevel(bibliopixel.log.DEBUG)
numLeds = 10
driver = PiWS281X(num = numLeds, gpio = 18)
load the LEDStrip class
from bibliopixel.layout import *
led = Strip(driver)
color = (random.randint(1,180), random.randint(1,180), random.randint(1,180))
for i in range (numLeds):
print ('LED '+str(i+1))
led.set(i, color)
led.update()
time.sleep(0.1)
Nothing below here works
from BiblioPixelAnimations.strip.ColorWipe import ColorWipe
anim = ColorWipe(led)
anim.run()
``
There are no errors when running this, just … nothing happens after my for loop. Any guidance would be greatly appreciated.
-Jerry