@tull I’ve been runing a test similar to yours, however I am blinking LEDs a lot faster with 20ms intervals to be able to reproduce this issue more quickly.
#!/usr/bin/python
from blinkstick import blinkstick as bstick
import time
#Search for BlinkStick only once
sticks = bstick.find_all()
while True:
for b in sticks:
b.blink(red=100,green=100,blue=100,index=0,name=None, repeats=1,delay=20)
time.sleep(0.02); #Add 20ms delay after blink command
b.blink(red=100,green=100,blue=100,index=1,name=None, repeats=1,delay=20)
time.sleep(0.02); #There needs to be a 20ms delay here too
I’ve been running the code above for the last hour and it has not crashed with pipe error. This means that it has been blinking for almost 100000 times. I’ll leave it running for the rest of today.
I am still investigating this issue, but I suspect that once RPi sends the information too fast to the BlinkStick, USB controller gets into a broken state which causes more random pipe errors until RPi is rebooted.
The is updated equivalent of your code below.
#!/usr/bin/python
from blinkstick import blinkstick as bstick
import time
#Search for BlinkStick only once
sticks = bstick.find_all()
while True:
for b in sticks:
b.blink(red=100,green=100,blue=100,index=0,name=None, repeats=1,delay=250)
time.sleep(0.02); #Add 20ms delay after blink command
b.blink(red=100,green=100,blue=100,index=1,name=None, repeats=1,delay=250)
time.sleep(0.02); #There needs to be a 20ms delay here too
A few notes:
- Make sure that the Pi is rebooted when running this code: shut down, unplug power and plug it back in
- I have modified the code to search for BlinkStick only once. This is a good optimization unless you will be running this code to constantly enumerate BlinkStick devices connected to Pi, because you will be plugging BlinkSticks in and out when running this script.