Serial Monitor displays only blocks (SOLVED)

In only one sketch I cannot make the serial monitor to show normal text. only squares are displayed.
Baud rates are set correctly, tried different baud rates, same NodeMCU used on same COM port, other sketches do show correctly, tried different text instead of just the dot, tried Serial.println() but it doesn't make new lines ...
Removed all complexity in the sketch, nothing changed (sketch is working) :

 int PB0 = 16; // D0 = LED at USB connector (blink to show heartbeat)
int PBH = 1;  // TX = LED on PCB for heartbeat
int PB8 = 2;  // D4 = Push Button 8 = grey LED at antenna (only after boot)

// PB Pin states
int PB0state = 0;
int PB8state = 0;

// PB milliseconds
const long HB = 2500;  // heartbeat duration for PB0

long ms0 = 0;

void setup() {
    Serial.begin(19200);
    delay(500);

    pinMode(PB0, OUTPUT);
    pinMode(PBH, OUTPUT);
    pinMode(PB8, OUTPUT);

    digitalWrite(PB0, 0);
    digitalWrite(PB8, 1);

    Serial.println(" ");
    Serial.println("HTTP server started");
    Serial.print("VMBGATE Local IP is : ");

}

void loop() {
    if (millis() - ms0 >= HB) {
        ms0 = millis();
        Serial.println(".");  // just print a dot every 2500ms (should do a linefeed, but doesn't and prints only squares)
        PB0state = !PB0state;                 // toggle status
        digitalWrite(PB0, PB0state);          // heartbeat on PCB
        digitalWrite(PBH, !PB0state);         // heartbeat on connector (inverted to keep current low)
    }

}

would those conflict with the Serial UART ?
which exact board do you have?

Hi, board info doesn't tell me much, but on the packaging I can read W05703 C4-305 NodeMcu Lua WiFi ESP8266 CP2102 2021-12-09.
image
I commented out all GPIO-pin related lines, and now it shows indeed the correct text, including line feeds.
Super hint :slight_smile: I will now re-integrate pin by pin to see which one(s) create the problem and will feedback on this post. Thank you.

GPIO1 (the one you called PBH) my be TXD0, the Serial Tx pin

Compiler shows as ESP8266EX WiFi 26MHz 4MB Flash.
After test it seems that command pinmode(PBH, OUTPUT); corrupts the working of the serial monitor. It is pin D0 = GPIO16 = connected to the onboard LED close to the USB connector. This is a little bit annoying as I use it as a visual check during development, but then I also need the serial monitor for debugging as well. A limitation for this great product.

don't use the Serial pins for something else than Serial if you use Serial :slight_smile:

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