I was having an issue requiring to unplug from USB power to reset the BLE Module and kept noticing unexpected Serial print behavior.
Using this sketch for testing:
void setup() {
// delay(1201); // For Upload
// delay(850); // For USB Plugin
// No Delay for Reset
Serial.begin(9600);
while (!Serial) {};
Serial.println("Serial enabled");
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("Time to Blink");
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
On my laptop while (!Serial) {}; only seems to properly work when I restart a sketch with the Reset button.
When I upload the sketch "Serial enabled" does not get sent to the Serial Monitor unless I add a delay > 1200.
When I plug the R4 WiFi into USB to power it up a delay of 850 is needed for "Serial enabled" to be printed.
Not sure if it matters, but it was unexpected behavior since no delay is necessary when using the reset button.
PS - the function is changing lowercase 'l' to uppercase 'L' after //'s