-
Notifications
You must be signed in to change notification settings - Fork 1
/
swirl.py
34 lines (28 loc) · 895 Bytes
/
swirl.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
'''
Configure the LED into a spinning swirl
'''
from tree import FastRGBChristmasTree
from time import sleep
if __name__ == '__main__':
tree = FastRGBChristmasTree()
i = 0
j = 1
k = 2
l = 3
tree[3] = [255,255,255]
while True:
tree[:,i*2] = [[255, 0, 0], [255, 255, 0], [0, 255, 0]]
tree[:,i*2+1] = [[255, 0, 0], [255, 255, 0], [0, 255, 0]]
tree[:,j*2] = [[255, 255, 0], [0, 255, 0], [0, 0, 255]]
tree[:,j*2+1] = [[255, 255, 0], [0, 255, 0], [0, 0, 255]]
tree[:,k*2] = [[0, 255, 0], [0, 0, 255], [255, 0, 0]]
tree[:,k*2+1] = [[0, 255, 0], [0, 0, 255], [255, 0, 0]]
tree[:,l*2] = [[0, 0, 255], [255, 0, 0], [255, 255, 0]]
tree[:,l*2+1] = [[0, 0, 255], [255, 0, 0], [255, 255, 0]]
tree.commit()
t = i
i = j
j = k
k = l
l = t
sleep(0.5)