ESP32 Dev Mod in Arduino IDE

What the hell?????

I see YYYYYYYY in serial monitor.
But I never see XXXXXXX.
void setup() must be called otherwise I would never see YYYYYYYY.
But why is XXXXXXX never output????

void setup() 
{
  Serial.begin(115200);
  while (!Serial);

  Serial.println(F("XXXXXXX"));
}

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

try adding a short delay to give Serial time to start, e.g.

void setup() 
{
  Serial.begin(115200);
  while (!Serial);
  delay(1000);
  Serial.println(F("XXXXXXX"));

on an ESP32 serial monitor displays

XXXXXXX
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY
YYYYYYYY
1 Like

Have you checked that !Serial actually pauses, add a small delay before the XXX. Note the timestamp, subtract the delay and that is how long the Serial port took to initialize.

It won't. The !Serial construct is only useful if used on a processor with native USB port, not a UART-based port as on an ESP32 Dev Board.

Yes.

3 Likes