Merge pull request #423 from snoerenberg/master

New X-Mas Effect added

Former-commit-id: 552d1ade7ca0f31b05629eede8430ef3a559984a
This commit is contained in:
tvdzwan 2016-01-13 22:41:40 +01:00
commit a9fd39df17
2 changed files with 36 additions and 0 deletions

8
effects/x-mas.json Normal file
View File

@ -0,0 +1,8 @@
{
"name" : "X-Mas",
"script" : "x-mas.py",
"args" :
{
"sleepTime" : 0.75
}
}

28
effects/x-mas.py Normal file
View File

@ -0,0 +1,28 @@
import hyperion
import time
import colorsys
# Get the parameters
sleepTime = float(hyperion.args.get('sleepTime', 1.0))
# Initialize the led data
ledDataOdd = bytearray()
for i in range(hyperion.ledCount):
if i%2 == 0:
ledDataOdd += bytearray((int(255), int(0), int(0)))
else:
ledDataOdd += bytearray((int(255), int(255), int(255)))
ledDataEven = bytearray()
for i in range(hyperion.ledCount):
if i%2 == 0:
ledDataEven += bytearray((int(255), int(255), int(255)))
else:
ledDataEven += bytearray((int(255), int(0), int(0)))
# Start the write data loop
while not hyperion.abort():
hyperion.setColor(ledDataOdd)
time.sleep(sleepTime)
hyperion.setColor(ledDataEven)
time.sleep(sleepTime)