Skip to content
Discussion options

You must be logged in to vote

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 using asyncio.wait_for. The task will time out when the UART stream is empty.

The merit of this approach is that it is non-blocking.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@kenjican
Comment options

@peterhinch
Comment options

Answer selected by kenjican
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
ESP32
Labels
None yet
2 participants