import time
from blinkstick import blinkstick
from random import randint
red = randint(0, 63)
green = randint(0, 63)
blue = randint(0, 63)
x=0
#Find the first BlinkStick
bstick = blinkstick.find_first()
bstick.set_mode(0) #
while(1):
for a in range(0,8):
red = randint(0, 63)
green = randint(0, 63)
blue = randint(0, 63)
bstick.set_color(0, a, red, green, blue)
time.sleep(0.01)
time.sleep(2)
bstick.set_color(0)
Square does not support mode 0, it’s only for BlinkStick Pro.
Use the following command to reset the mode to normal WS2812:
blinkstick --set-mode 2
Then unplug and plug the device back into the PC. You need to do only once.
Update your script to this:
import time
from blinkstick import blinkstick
from random import randint
#Find the first BlinkStick
bstick = blinkstick.find_first()
while(1):
for a in range(0,8):
red = randint(0, 63)
green = randint(0, 63)
blue = randint(0, 63)
bstick.set_color(0, a, red, green, blue)
#Would suggest adding a 20ms timeout before setting next color
time.sleep(0.02)
time.sleep(2)