-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitv2_test_ws2812.py
65 lines (59 loc) · 1.3 KB
/
bitv2_test_ws2812.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
55
56
57
58
59
60
61
62
63
64
65
from webduino import Board
import network
import machine, neopixel,time,random
import esp
#esp.osdebug(0,esp.LOG_INFO)
bb = 5
machine.freq(240000000)
def setLED(r,g,b):
for led in range(25):
np[12] = (r,g,b)
#state = machine.disable_irq()
np.write()
#machine.enable_irq(state)
def pureStart():
for i in range(1000):
led = i % 6
if led == 0:
setLED(bb,0,0)
if led == 1:
setLED(bb,bb,0)
if led == 2:
setLED(0,bb,bb)
if led == 3:
setLED(bb,0,bb)
if led == 4:
setLED(bb,bb,bb)
if led == 5:
setLED(0,0,0)
def ctrlLED(cmd):
print("cmd:",cmd)
data = cmd.split(' ')
led = int(data[1]) % 6
if led == 0:
setLED(bb,0,0)
if led == 1:
setLED(bb,bb,0)
if led == 2:
setLED(0,bb,bb)
if led == 3:
setLED(bb,0,bb)
if led == 4:
setLED(bb,bb,bb)
if led == 5:
setLED(0,0,0)
#eval(cmd)
def boardStart():
bit = Board(devId='home',enableAP=False)
bit.connect('webduino.io','webduino')
setLED(0,5,0)
print("start...")
bit.onMsg('ledTest',ctrlLED)
bit.loop()
print(1)
np = neopixel.NeoPixel(machine.Pin(18), 25)
print(2)
setLED(5,0,0)
print(3)
boardStart()
#pureStart()