]>
vault307.fbx.one Git - ir_remote.git/blob - primitives/tests/encoder_test.py
1 # encoder_test.py Test for asynchronous driver for incremental quadrature encoder.
3 # Copyright (c) 2021-2022 Peter Hinch
4 # Released under the MIT License (MIT) - see LICENSE file
6 from machine
import Pin
7 import uasyncio
as asyncio
8 from primitives
.encoder
import Encoder
11 px
= Pin(33, Pin
.IN
, Pin
.PULL_UP
)
12 py
= Pin(25, Pin
.IN
, Pin
.PULL_UP
)
19 await asyncio
.sleep(1)
22 print('Running encoder test. Press ctrl-c to teminate.')
23 enc
= Encoder(px
, py
, v
=0, vmin
=0, vmax
=100, callback
=cb
)
26 except KeyboardInterrupt:
29 asyncio
.new_event_loop()