forked from Hack-a-Day/Vectorscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA.py
34 lines (27 loc) · 756 Bytes
/
A.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
from vectorscope import Vectorscope
import vectoros
import keyboardcb
import keyleds
import asyncio
import random_walk
_abort=False
async def random_walker(v):
## Minimal example
global _abort
r = random_walk.RW(v)
x,y = 0,0
while _abort==False:
x,y = r.random_walk(x,y)
## this is important -- it yields to the key scanner
await asyncio.sleep_ms(10)
## Below here is boilerplate.
def do_abort(key):
global _abort
_abort=True
from vos_state import vos_state
async def slot_main(v):
global _abort
# watch the keys -- you can define your own callbacks here
mykeys = keyboardcb.KeyboardCB( {keyleds.KEY_MENU: do_abort} )
await random_walker(v)
print("OK done")