Skip to content
Advertisement

How to do non blocking usb serial input in circuit python?

I am trying to interface a micropython board with python on my computer using serial read and write, however I can’t find a way to read usb serial data in micropython that is non-blocking.

Basicly I want to call the input function without requiring an input to move on. (something like https://github.com/adafruit/circuitpython/pull/1186 but for usb)

I have tried using tasko, uselect (it failed to import the library and I can’t find a download), and await functions. I’m not sure it there is a way to do this, but any help would be appreciated.

Advertisement

Answer

For CircuitPython there’s supervisor.runtime.serial_bytes_available which may provide the building block for what you want to do.

This is discussed on Adafruit Forums: Receive commands from the computer via USB.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement