Closed
Description
hiya, some arduino code out there uses code chunks like this
while (! Serial) {
delay(1);
}
Serial.begin(115200);
to avoid starting until a USB serial object is instatiated. the expected behavior for UART serial devices is that Serial is not null, and the while loop is skipped (e.g. ESP8266). however, on ESP32 you would need to call begin() beforehand
Serial.begin(115200);
while (! Serial) {
delay(1);
}
or the ESP32 will hang waiting. while i agree that the current behavior is more correct it may not match expectations since other UART-USB devices (Arduino UNO, ESP8266, etc) always have Serial non-null. perhaps making Serial always eval to non-null to match ESP8266 behavior, otherwise we'll just have to give people a lot of warnings :)
Metadata
Metadata
Assignees
Labels
No labels