Skip to content

Is there a way for the ESP32 (S3) to wait until a serial port/monitor has been started?  #7989

@zztiger123

Description

@zztiger123

Board

ESP32/ESP32-S3

Device Description

For example, ESP32-S3-WROOM-1-N16R8

Hardware Configuration

N/A

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

N/A

Flash frequency

40 Mhz

PSRAM enabled

yes

Upload speed

115200

Description

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.

Sketch

while (!Serial) {

   ; // wait for serial port to connect. Needed for native USB port only

  }

Serial.println("*****************************************************");

  Serial.println(" Com port is open");

Debug Message

N/A

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Status: SolvedThe issue has been resolved and requires no further action.Type: QuestionOnly question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions