Page 1 of 1

ESP32 communication via USB UART

Posted: Wed Jun 15, 2022 11:51 am
by renataa_l
Hello!
As one of my first projects, I'm trying to establish UART communication between my ESP32 and my PC via USB, specifically having ESP send a string to PC. However, the only thing I'm viewing is strings that are printed, not written in UART's functions. I'm using pyserial to check the COM port, as well as Hercules software. Can somebody help me?

Image

Re: ESP32 communication via USB UART

Posted: Wed Jun 15, 2022 12:06 pm
by Roberthh
The interface attached to the USB port is not registered as an UART. You can send strings using print() or sys.stdout.write(). or sys.stderr.write().

Re: ESP32 communication via USB UART

Posted: Thu Jun 30, 2022 8:13 am
by renataa_l
Thank you! By the way, how can I do it the other way around: send a string from PC to ESP32?

Re: ESP32 communication via USB UART

Posted: Thu Jun 30, 2022 8:30 am
by Roberthh
That depends on your programming environment and operating system. You have to write data to the serial port, which is registered as interface to the ESP32. With Windows, this is a COMx port. With linux , its a /dev/tty_USBx device, with OS X, a /dev/tty_xxxx device. xxxx for varying numbers or names.