hyperion.ng/effects/loop2.py
jm-github fb8c10876b 5 more effects
Former-commit-id: e6a826299ad48143cb155e7113a34bd6d3b20246
2014-10-30 16:02:30 +00:00

34 lines
694 B
Python

import hyperion
import time
import colorsys
import random
# Initialize the led data
ledData = bytearray()
for i in range(hyperion.ledCount):
ledData += bytearray((0,0,0))
sleepTime = 0.005
runners = [
{ "pos":0, "step":4 , "lvl":255},
{ "pos":1, "step":5 , "lvl":255},
{ "pos":2, "step":6 , "lvl":255},
{ "pos":0, "step":7 , "lvl":255},
{ "pos":1, "step":8 , "lvl":255},
{ "pos":2, "step":9, "lvl":255},
]
# Start the write data loop
count = 0
while not hyperion.abort():
count += 1
for r in runners:
if count%r["step"] == 0:
ledData[r["pos"]] = 0
r["pos"] = (r["pos"]+3)%(hyperion.ledCount*3)
ledData[r["pos"]] = r["lvl"]
hyperion.setColor(ledData)
time.sleep(sleepTime)