waiting for serial port to open; Arduino IDE
Posted: Thu Mar 23, 2023 6:52 am
Is there a way for the ESP32 (S3) to wait until a serial port/monitor has been started? I’m using the Arduino IDE. On non-ESP32 boards, I’ve used something like this:
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("*****************************************************");
Serial.println(" Com port is open");
This code doesn’t work with the ESP32. Any other suggestions? I need to print out a message to the serial port, but need to wait until the serial port and terminal/console are open/ready. Since the code currently isn’t able to wait, I lose the first few serial port prints as it takes a few seconds to manually open up the serial monitor program.
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("*****************************************************");
Serial.println(" Com port is open");
This code doesn’t work with the ESP32. Any other suggestions? I need to print out a message to the serial port, but need to wait until the serial port and terminal/console are open/ready. Since the code currently isn’t able to wait, I lose the first few serial port prints as it takes a few seconds to manually open up the serial monitor program.