Hello World compiles and runs from Arduino but not on PlatformIO - Why?

This simple program for ESP-01s (1M) in the Arduino IDE:

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.println("Hello World!");
}

compiles and downloads to target. After a reboot, it produces output on any serial monitor, including the PlatformIO monitor. Nothing exciting to see here.

Next, I move the program to PlatformIO and include Arduino.h:

#include <Arduino.h>

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.println("Hello World!");
}

The program compiles and downloads to target. A quick reboot, but no serial output. Not on PlatformIO, Arduino, or Teraterm.

Recompile in the Arduino IDE, and the program runs as expected once again.

platformio.ini

platform = espressif8266
board = esp01_1m
framework = arduino
monitor_speed = 9600

What am I missing or doing wrong?

Duplicate of ESP01 code upload works with Arduino IDE but not with PIO? - #8 by maxgerhardt?

1 Like