forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Milestone
Description
One of the many uses of async coroutines is waiting for user input while completing background tasks.
There are examples for buttons, but digitalIO.value wasn't a blocking function anyway so polling it is trivial.
My issue is that I am trying to use the serial console to interact with the device, and input()
is most definitely a blocking function.
The implementations I've found seem to be platform-dependent, communicating with a separate UI thread or relying on non-standard libraries. Even the aioconsole library seems to do this.
It seems there should be a non-blocking way to read from sys.stdio, as it's a stream. There is some discussion of this in the circuitpython docs, but no methods given. The asyncio streams appear to be TCP-only.