-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.py
42 lines (30 loc) · 783 Bytes
/
init.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
import time
import gc
from machine import Timer
from _educore.ble import CBle
from educore import button
bleCode: None | CBle
bleCode = CBle("LekitV3C")
bleCode.start_advertising()
flag = False
def ignore():
pass
def sendfunction():
global bleCode, flag
while btn.status():
if btnb.status():
bleCode.showCode()
btn.event_pressed = ignore
flag = True
break
time.sleep_ms(100)
def close(_):
if bleCode is not None and not flag:
if bleCode.status:
bleCode.close()
btn.event_pressed = ignore
gc.collect()
btn = button(button.a)
btnb = button(button.b)
btn.event_pressed = sendfunction
# Timer(0).init(period=5000, mode=Timer.ONE_SHOT, callback=close)