I am just learning how to use the PIO extension on MS Visual Studio Code, after having previously worked only with the Arduino IDE. I am using a [AI Thinker ESP32-CAM] on a [ESP32-CAM-MB serial interface motherboard]. I started at square one with a simple blink program, and that program loads and runs just fine with VSC and PIO (as it did when I used the Arduino IDE). So far, so good.
Wanting to add incrementally to my skills, I then added two lines to the program to provide serial port communication to the program:
in Setup() I added: Serial.begin(115200);
in Loop() I added: Serial.println(“testing”);
When I run this program the LED blinks just as before and everything is still fine. But the program halts when I go to PIO’s SERIAL MONITOR window and click on “Start Monitoring” to view the message “testing” being sent by the Serial.println() function. The LED no longer blinks, and I see nothing at all coming from the serial port. When I click “Stop Monitoring” the program restarts from the beginning and runs just fine again.
To troubleshoot this I left the program running correctly and opened the Arduino IDE. Using that program’s serial monitor window I see the “testing” statement being printed correctly to the serial port. So I can confirm that the program is functioning correctly in all regards – the additional Serial.println() statement is being executed every time the LED blinks.
So what does PIO do differently than Arduino IDE when it comes to this serial port monitor? How can I get the serial monitor working properly in PIO? As far as I can see, both of the serial port parameters have been set correctly (baud rate and line ending), and I have tried the other settings anyway but it has not helped. Something is going on, but I can’t see what that is or how to change it. It appears PIO’s Serial Monitor begins by sending some sort of message to the interface board, and that message halts the program.
What am I missing???