forked from penfold42/hyperion-effects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmas3.py
44 lines (41 loc) · 1.26 KB
/
xmas3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import hyperion
import time
import colorsys
# Get the parameters
sleepTime = float(hyperion.args.get('sleepTime', 1.0))
colorOne = hyperion.args.get('color_one', (255,0,0))
colorTwo = hyperion.args.get('color_two', (0,255,0))
colorThree = hyperion.args.get('color_three', (255,255,255))
# Initialize the led data
ledDataOdd = bytearray()
for i in range(hyperion.ledCount):
if i%3 == 0:
ledDataOdd += bytearray(colorOne)
if i%3 == 1:
ledDataOdd += bytearray(colorTwo)
if i%3 == 2:
ledDataOdd += bytearray(colorThree)
ledDataEven = bytearray()
for i in range(hyperion.ledCount):
if i%3 == 0:
ledDataEven += bytearray(colorThree)
if i%3 == 1:
ledDataEven += bytearray(colorOne)
if i%3 == 2:
ledDataEven += bytearray(colorTwo)
ledDataThirdWheel = bytearray()
for i in range(hyperion.ledCount):
if i%3 == 0:
ledDataThirdWheel += bytearray(colorTwo)
if i%3 == 1:
ledDataThirdWheel += bytearray(colorThree)
if i%3 == 2:
ledDataThirdWheel += bytearray(colorOne)
# Start the write data loop
while not hyperion.abort():
hyperion.setColor(ledDataOdd)
time.sleep(sleepTime)
hyperion.setColor(ledDataEven)
time.sleep(sleepTime)
hyperion.setColor(ledDataThirdWheel)
time.sleep(sleepTime)