2016-01-20 22:36:21 +01:00
|
|
|
import hyperion, time, colorsys, random
|
|
|
|
|
|
|
|
# get args
|
|
|
|
sleepTime = float(hyperion.args.get('speed', 1.0))
|
|
|
|
saturation = float(hyperion.args.get('saturation', 1.0))
|
|
|
|
ledData = bytearray()
|
2014-10-30 17:02:30 +01:00
|
|
|
|
|
|
|
# Initialize the led data
|
|
|
|
for i in range(hyperion.ledCount):
|
|
|
|
ledData += bytearray((0,0,0))
|
|
|
|
|
|
|
|
# Start the write data loop
|
|
|
|
while not hyperion.abort():
|
|
|
|
hyperion.setColor(ledData)
|
|
|
|
for i in range(hyperion.ledCount):
|
|
|
|
if random.randrange(10) == 1:
|
2016-01-20 22:36:21 +01:00
|
|
|
rgb = colorsys.hsv_to_rgb(random.random(), saturation, random.random())
|
2014-10-30 17:02:30 +01:00
|
|
|
ledData[i*3 ] = int(255*rgb[0])
|
|
|
|
ledData[i*3+1] = int(255*rgb[1])
|
|
|
|
ledData[i*3+2] = int(255*rgb[2])
|
|
|
|
time.sleep(sleepTime)
|