First line of output not shown in Serial Monitor

Continuing the discussion from Serial Monitor Not Working On Esp32(SOLVED):

Yes, it is later.
I tested:

void setup() {
  Serial.begin(9600);
  while(!Serial);
  Serial.print("start!");
}

void loop() {
  Serial.println("hello");
  delay(1000);
}

got 'hello' printed out, but never has 'start!' print out, why?
Thanks

You can try adding a delay before that print in case the problem is caused by the port not being initialized soon enough:

void setup() {
  Serial.begin(9600);
  while(!Serial);
  delay(1000);
  Serial.print("start!");
}

void loop() {
  Serial.println("hello");
  delay(1000);
}
1 Like

Thanks.
Same result.
And the USB port lost connection after reset button pressed, need unplug and plug again to get connect.

Another phenomenon is that the serial monitor lost connection when the Baud Rate of communication be changed say from 9600 to 115200.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.