implement random_grb() function

master
lub 4 years ago
parent a4aaae856d
commit 7affaf04b1

@ -3,6 +3,16 @@ from blinkstick import blinkstick
from random import randint, choice
from time import sleep
def random_grb():
"""
Get a random GRB array.
"""
# get a random initial color
return [
randint(1, 255),
randint(1, 255),
randint(1, 255)
]
def set_all_leds(device, grb=[0,0,0]):
"""
Takes a GRB color array as input and sets the color on all LEDs.
@ -49,11 +59,7 @@ def morph_grb(grb, steps, mode='single'):
device = blinkstick.find_first()
# get a random initial color
grb = [
randint(1, 255),
randint(1, 255),
randint(1, 255)
]
grb = random_grb()
while True:
set_all_leds(device, grb)