-
Notifications
You must be signed in to change notification settings - Fork 1
/
code.py
51 lines (35 loc) · 1.07 KB
/
code.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
import board
import neopixel
from ledPixelsPico import *
import touchio
nPix = 30
pix = ledPixels(nPix, board.GP15)
touch = touchio.TouchIn(board.GP16)
print("Start touch", touch.value)
switch = True
while True:
if switch:
for j in range(255):
for i in range(pix.nPix):
pixel_index = (i * 256 // pix.nPix) + j
pix.pixels[i] = pix.wheel(pixel_index & 255, 0.5)
if touch.value:
pix.light(0, (200,0,0))
while touch.value:
time.sleep(0.1)
switch = not switch
print("Touch", switch)
pix.setColor((0,0,0))
#time.sleep(0.5)
break
pix.pixels.show()
time.sleep(0.01)
#time.sleep(0.5)
if touch.value:
pix.light(0, (200,0,0))
while touch.value:
time.sleep(0.1)
switch = not switch
#print("Touch On", switch)
#time.sleep(0.5)
# pix.rainbowForever(speed=0.001)