It must match Serial.begin(baudRate)
in your sketch (default for ESPHome is usually 115200, but some examples use 9600).
Ensure Serial Monitor is Closed During Upload.
Try a minimal working sketch:
void setup() {
Serial.begin(115200);
delay(1000); // Wait a bit for Serial to initialize
Serial.println("Booting...");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
Serial.println("Blink");
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
Open Serial Monitor at 115200 baud and look for output. The problem may happen due to wrong SSID/password. It is also possible that WiFi.begin()
is not being followed by WiFi.waitForConnectResult()
or while (!WiFi.isConnected()) {...}
If you want to keep all info about MQTT always handy, you can see here: ESP32 MQTT - The Engineering Projects