New X-Mas Effect added

Former-commit-id: d34644b1cab491b4f5c326d77098d9ee198f0b11
This commit is contained in:
snoerenberg 2015-12-09 16:08:26 +01:00
parent d5529e86df
commit 8a6414b250
2 changed files with 42 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" :
{
"frequency" : 50.0
}
}

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

@ -0,0 +1,34 @@
import hyperion
import time
import colorsys
# Get the parameters
frequency = float(hyperion.args.get('frequency', 10.0))
# Check parameters
frequency = min(100.0, frequency)
# Compute the strobe interval
sleepTime = 1.0 / frequency
# 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(0.75)
hyperion.setColor(ledDataEven)
time.sleep(0.75)