From 8a6414b2509877202abdaa32c12ae2b68f21807b Mon Sep 17 00:00:00 2001 From: snoerenberg Date: Wed, 9 Dec 2015 16:08:26 +0100 Subject: [PATCH 1/2] New X-Mas Effect added Former-commit-id: d34644b1cab491b4f5c326d77098d9ee198f0b11 --- effects/x-mas.json | 8 ++++++++ effects/x-mas.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 effects/x-mas.json create mode 100644 effects/x-mas.py diff --git a/effects/x-mas.json b/effects/x-mas.json new file mode 100644 index 00000000..99bece03 --- /dev/null +++ b/effects/x-mas.json @@ -0,0 +1,8 @@ +{ + "name" : "X-Mas", + "script" : "x-mas.py", + "args" : + { + "frequency" : 50.0 + } +} diff --git a/effects/x-mas.py b/effects/x-mas.py new file mode 100644 index 00000000..bdeda2e7 --- /dev/null +++ b/effects/x-mas.py @@ -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) \ No newline at end of file From d3b3ce7630d524e82ff212cf658e99f1a6ea3064 Mon Sep 17 00:00:00 2001 From: snoerenberg Date: Wed, 9 Dec 2015 16:18:08 +0100 Subject: [PATCH 2/2] New X-Mas Effect added Former-commit-id: b5fb724f5b07f1cd55fef620c02f285522680cf6 --- effects/x-mas.json | 2 +- effects/x-mas.py | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/effects/x-mas.json b/effects/x-mas.json index 99bece03..72892a52 100644 --- a/effects/x-mas.json +++ b/effects/x-mas.json @@ -3,6 +3,6 @@ "script" : "x-mas.py", "args" : { - "frequency" : 50.0 + "sleepTime" : 0.75 } } diff --git a/effects/x-mas.py b/effects/x-mas.py index bdeda2e7..697d6f71 100644 --- a/effects/x-mas.py +++ b/effects/x-mas.py @@ -3,13 +3,7 @@ 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 +sleepTime = float(hyperion.args.get('sleepTime', 1.0)) # Initialize the led data ledDataOdd = bytearray() @@ -29,6 +23,6 @@ for i in range(hyperion.ledCount): # Start the write data loop while not hyperion.abort(): hyperion.setColor(ledDataOdd) - time.sleep(0.75) + time.sleep(sleepTime) hyperion.setColor(ledDataEven) - time.sleep(0.75) \ No newline at end of file + time.sleep(sleepTime) \ No newline at end of file