5 more effects

Former-commit-id: e6a826299ad48143cb155e7113a34bd6d3b20246
This commit is contained in:
jm-github
2014-10-30 16:02:30 +00:00
parent d1f043f233
commit fb8c10876b
10 changed files with 195 additions and 0 deletions

25
effects/random.py Normal file
View File

@@ -0,0 +1,25 @@
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.001
# Start the write data loop
while not hyperion.abort():
hyperion.setColor(ledData)
for i in range(hyperion.ledCount):
if random.randrange(10) == 1:
hue = random.random()
sat = 1.0
val = random.random()
rgb = colorsys.hsv_to_rgb(hue, sat, val)
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)