asyncio not compatible with micropython v1.23.0 ? #15442
-
|
Beta Was this translation helpful? Give feedback.
Answered by
peterhinch
Jul 17, 2024
Replies: 2 comments 2 replies
-
V1.23 is definitely compatible with
|
Beta Was this translation helpful? Give feedback.
2 replies
-
Thanks Peter, testing in V1.24.1 ESP32C3. Replace uart.read() in async def sender(): with sreader.read() .It works. Even I dont know why,problem solved~~ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To ensure the UART input stream is clear, create the
StreamReader
when the application starts. Create a coroutine that reads characters from the stream and discards them. Then call it usingasyncio.wait_for
. The task will time out when the UART stream is empty.The merit of this approach is that it is non-blocking.