MicroPython_ESP32_psRAM_LoBo icon indicating copy to clipboard operation
MicroPython_ESP32_psRAM_LoBo copied to clipboard

How to send bytes back and forth over USB?

Open justinmoon opened this issue 6 years ago • 1 comments

This is trivial on Arduino -- just call Serial.read and Serial.write. Isn't there anything comparable here?

I want to plug my m5stack into a computer and run a command line tool (PySerial) which can send bytes to the m5stack and receive bytes from the m5stack.

The UART to USB converter is attached to UART0 -- so I'd like to use this. But it's disabled.

I tried machine.stdin_get and machine.stdin_put but these seemed very clunky and interfered with debugging.

What's the best way to accomplish this?

justinmoon avatar Jan 19 '19 07:01 justinmoon

print () and input ()

You may need to use thread for input() as it is blocking until you type something in . Also take a look at dupterm()

curlyz avatar Feb 12 '19 02:02 curlyz