Skip to content

Commit

Permalink
dupterm
Browse files Browse the repository at this point in the history
  • Loading branch information
lerouxb committed Dec 26, 2019
1 parent f8dc178 commit ec2ef64
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions py/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from machine import Timer, UART
import micropython

uart = UART(2, 115200)
uart.init(115200, bits=8, parity=None, stop=1)
uos.dupterm(uart)

timer = Timer(-1)

def schedule_poll(ignore=None):
micropython.schedule(check, 0)

def check(ignore=None):
if uart.any():
uos.dupterm_notify(uart)
timer.init(period=10, mode=Timer.ONE_SHOT, callback=schedule_poll)

check()

0 comments on commit ec2ef64

Please sign in to comment.