PlatformIO is an embedded development platform that runs as a VS Code extension. It replaces the Arduino IDE's board manager, library manager, and build system with a unified toolchain that supports over 1,500 boards across 50+ frameworks. It handles dependency resolution, cross-platform compilation, and serial debugging from within the VS Code editor.
When projects grow beyond a single sketch file — multiple source files, custom libraries, build configurations per board — PlatformIO manages the complexity that Arduino IDE was not designed for. It also provides proper IntelliSense, linting, and debugging that professional embedded workflows require.
Used in: SG-21 SG-22
Download VS Code first if you do not have it: https://code.visualstudio.com
Ctrl+Shift+X / Cmd+Shift+X).If you prefer the CLI without VS Code:
pip install platformio
Verify the install:
pio --version
Same as Arduino IDE — add yourself to dialout:
sudo usermod -aG dialout $USER
Log out and back in for this to take effect.
platformio.ini config file and a src/ folder for your code.src/main.cpp. PlatformIO uses .cpp files, not .ino. Add #include <Arduino.h> at the top — the Arduino IDE adds this implicitly, PlatformIO does not.platformio.ini and add a lib_deps line:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
adafruit/Adafruit NeoPixel@^1.12.0
PlatformIO downloads the library automatically on next build.
pio run --target upload
pio device monitor --baud 115200
PlatformIO takes several minutes on first install to download toolchains. The extension installs Python, the PIO Core, and platform packages. Do not close VS Code or assume it is frozen — watch the progress bar in the VS Code status bar. On slow connections this can take 10+ minutes.
Arduino .ino files do not work directly. Rename them to .cpp, add #include <Arduino.h> at the top, and ensure all function prototypes are declared before use. The Arduino IDE auto-generates prototypes; PlatformIO follows standard C++ rules.
"No such board" errors after selecting a board. The platform package for that board family may not be installed yet. PlatformIO downloads platform packages on demand. Check platformio.ini — the platform line must match your board (e.g., espressif32 for ESP32 boards, atmelavr for Arduino Uno/Nano).
VS Code IntelliSense shows red squiggles on valid Arduino code. Run PlatformIO: Rebuild IntelliSense Index from the Command Palette (Ctrl+Shift+P). PlatformIO generates a .vscode/c_cpp_properties.json that the C/C++ extension reads — it sometimes falls out of sync after adding libraries.
PlatformIO and Arduino IDE conflict on serial ports. Only one program can hold a serial port at a time. Close the Arduino IDE Serial Monitor before uploading from PlatformIO, and vice versa.