2016-12-03 21:11:52 +01:00
|
|
|
import hyperion, time, colorsys
|
2015-12-09 16:08:26 +01:00
|
|
|
|
|
|
|
# Get the parameters
|
2017-04-09 22:28:32 +02:00
|
|
|
sleepTime = float(hyperion.args.get('sleepTime', 1000))/1000.0
|
|
|
|
length = hyperion.args.get('length', 1)
|
|
|
|
color1 = hyperion.args.get('color1', (255,255,255))
|
|
|
|
color2 = hyperion.args.get('color2', (255,0,0))
|
2015-12-09 16:08:26 +01:00
|
|
|
|
|
|
|
# Initialize the led data
|
2017-04-09 22:28:32 +02:00
|
|
|
i = 0
|
2015-12-09 16:08:26 +01:00
|
|
|
ledDataOdd = bytearray()
|
2017-04-09 22:28:32 +02:00
|
|
|
while i < hyperion.ledCount:
|
|
|
|
for l in range(length):
|
|
|
|
if i<hyperion.ledCount:
|
|
|
|
ledDataOdd += bytearray((int(color1[0]), int(color1[1]), int(color1[2])))
|
|
|
|
i += 1
|
|
|
|
|
|
|
|
for l in range(length):
|
|
|
|
if i<hyperion.ledCount:
|
|
|
|
ledDataOdd += bytearray((int(color2[0]), int(color2[1]), int(color2[2])))
|
|
|
|
i += 1
|
|
|
|
|
|
|
|
ledDataEven = ledDataOdd[3*length:] + ledDataOdd[0:3*length]
|
2015-12-09 16:08:26 +01:00
|
|
|
|
|
|
|
# Start the write data loop
|
|
|
|
while not hyperion.abort():
|
|
|
|
hyperion.setColor(ledDataOdd)
|
2015-12-09 16:18:08 +01:00
|
|
|
time.sleep(sleepTime)
|
2015-12-09 16:08:26 +01:00
|
|
|
hyperion.setColor(ledDataEven)
|
2017-04-09 22:28:32 +02:00
|
|
|
time.sleep(sleepTime)
|