I switched to a simple arduino example which flashes a light as provided by PIO home tab and added some println(). The code works (cam flash light if flashing). But when i launch the serial monitor the flashing stops and no trace appears, then if i close (trash icon) the serial monitor the flashing resumes.
#include <Arduino.h>
// Set LED_BUILTIN if it is not defined by Arduino framework
#define LED_BUILTIN 4
void setup()
{
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println("Setup starting...");
Serial.flush();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(5);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Waiting 5s...");
Serial.flush();
delay(5000);
}