I have an ESP8266 Sparkfun Thing device, I use VSCode and PlatformIO and am trying to see the serial output.
The code is the simplest one: #include <Arduino.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, HIGH);
Serial.println(“LED is on”);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
Serial.println(“LED is off”);
delay(1000);
}
The code is built, uploaded, run successfully and the device blinks every second.
But when I click on “PlatformIO: Serial Monitor” I can see the following:
Executing task in folder A1: C:\Users\user.platformio\penv\Scripts\platformio.exe device monitor
— Terminal on COM9 | 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 Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
0␙�␎␃�
and after that the device stops blinking. Moreover I can’t see any output of Serial.printf.
My platformio.ini is
[env:thing]
platform = espressif8266
board = thing
framework = arduino
monitor_speed = 9600
Could you help me solve this issue?
Thanks in advance.
Maybe the bootloader is outputting an error message? Set monitor_speed = 74880, restart the serial monitor, press the RST/EN button on the board if there’s one. What’s the output?
Thanks for the reply.
I set monitor_speed = 74880 in platform.ini
built, uploaded, turned power off and on (I don’t have any buttons on the board).
The output is:
* Executing task in folder A1: C:\Users\user\.platformio\penv\Scripts\platformio.exe device monitor
--- Terminal on COM9 | 74880 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
ets Jan 8 2013,rst cause:2, boot mode:(1,7)
Aha, so the device is in bootloader mode. Likely caused by the serial monitor setting the DTR and RTS pins in a “position” that causes reboot to bootloader through the auto-reset circuit.
Please try all 4 possible combinations of monitor_rts and monitor_dtr being 0 or 1 per this topic and use the “Upload and Monitor” project task.