Serial Monitor not working with ESP8266

I’m having trouble using the Serial Monitor in PlatformIO. I used it last year for a project with no problems but am just getting back into things on a new project. I’m using a NodeMcu ESP8266 and am able to upload a basic blinking project just fine. However when I try to use the serial monitor (same port, baud rate matches the code) I don’t see any messages and it looks like the blinking code stops. If I open a different serial monitor like in Arduino thing seem to work just fine. I’ve also tried reinstalling visual studio code.

I’ve tried on a couple different boards and removed them from my custom board and it always works with the Arduino serial monitor and never with the PlatformIO one. Is there some setting that I am forgetting?

Here is what I see in the terminal. Maybe 1 in 10 times half a line shows up when I first start it and then nothing:

--- Terminal on COM7 | 9600 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp8266_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

Here is my platformio.ini

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
monitor_speed = 9600
monitor_port = COM7
upload_speed = 921600
upload_port = COM7
lib_deps = adafruit/Adafruit MCP23017 Arduino Library@^2.3.0

Here is my blink code where I was going to start implementing an IO expander (until I ran into issues with the serial monitor)

#include <Arduino.h>
#include <Adafruit_MCP23X17.h>
#include <Adafruit_MCP23X08.h>
#include <Adafruit_MCP23XXX.h>

#define LED_PASS_B1 16

#define SW_AUTO 14
#define SW_MAN  12

// Adafruit_MCP23X17 mcp;

void setup() {
  Serial.begin(9600);
  Serial.println("LED Array Jig Starting...");
  // if(!mcp.begin_I2C()) {
  //   Serial.println("Error. Can't connect to IO Expander");
  //   while(1); 
  // }

  // mcp.pinMode(0, OUTPUT);
  // mcp.writeGPIOA(0);

  pinMode(LED_PASS_B1, OUTPUT);

  pinMode(SW_AUTO,  INPUT);
  pinMode(SW_MAN,   INPUT);
}

void loop() {
  if( digitalRead(SW_AUTO) )
  {
    Serial.println("Button pressed");
    digitalWrite(LED_PASS_B1, 1);
  } else {
    digitalWrite(LED_PASS_B1, 0);
  }
}

If the sketch works for as long as you don’t open the serial monitor, but stops the moment you open it, hen you have misconfigured DTR/RTS lines and that causes the chip to held in reset.

Please try all available combinations from here.

Ahhh that’s super helpful, I’ve got it working now. Thank you so much maxgerhardt!