Loop and pulse usb error

Hi there.

I have several apps written using the blinkstick nanos which are working perfectly, lovely and stable. But I’ve hit a couple of problems today and wonder if anyone has the solution.

If I run the code example below I get a seemingly random number of cycles then:
USBError(_str_error[ret], ret, _libusb_errno[ret]) usb.code.USBError: [Errno 32] Pipe error

I’ve tried putting in sleeps and moving things around but no joy. I hope someone can find the problem.

Many thanks.


#!/usr/bin/python

from blinkstick import blinkstick as bstick
import random as rnd
import time

def main():
while True:
for bl in bstick.find_all():

                    r=rnd.randint(0,255)
                    g=rnd.randint(0,255)
                    b=rnd.randint(0,255)

                    bl.pulse(red=r, green=g, blue=b, duration=500, steps=100)

main()

Try decreasing the number of steps to 20.

Same.

I’ve done some more testing with other commands, set_random_color, even just blink. Anything in a loop confuses the USB port.

Do you (anyone) have a working python example of this kind I could look at?

Thanks.

You can find code examples in the wiki:

These extremely basic examples don’t replicate what I’m trying to do at all.