-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
54 lines (43 loc) · 897 Bytes
/
main.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
45
46
47
48
49
50
51
52
53
54
from board import *
from neopixel import *
from time import *
from math import *
from random import *
from digitalio import *
p1=NeoPixel(A0, 10)
p2=NeoPixel(A1, 10)
p1.brightness = .5
p2.brightness = .5
p1.fill((0,0,0))
p2.fill((0,0,0))
green = list(map(lambda x: (0, randint(64, 255), 0), range(0,10)))
greenish = list(map(lambda x: (randint(0, 64), randint(16, 255), randint(0,64)), range(0,10)))
party = [
( 0, 0, 0),
( 0, 0,255),
( 0,255, 0),
( 0,255,255),
(255, 0, 0),
(255, 0,255),
(255,255, 0),
(255,255,255),
]
button = DigitalInOut(A2)
button.direction = Direction.INPUT
xs = [green, greenish, party]
xn = 0
x = xs[xn]
n=0
while True:
if button.value:
xn = (xn + 1) % len(xs)
x = xs[xn]
p1.fill((255,0,0))
p2.fill((0,0,255))
sleep(0.4)
for i in range(0,10):
l = len(x)
p1[i] = x[(n+i) % l]
p2[i] = x[(n+(9-i)) % l]
n+=1
sleep(0.01)