Intro

Adapting PlatformIO to Arduino Project Structure 1. See PlatformIO (VS Code) for IDE integration

Setup

  • Move sketch folder/s to src

    • Note: the picture 4
  • To make compatible with PlatformIO:

    • include #include <Arduino.h> in each ino file
    • include function declarations above the setup() function (ex: void forward();)
    • Include the file in main.cpp, example:
#include <Arduino.h>
#include "arduino_blink_test/arduino_blink_test.ino"

Add a library

  • Open PIO home, click libraries, search for library, and click Add to Project picture 5

  • Or, in platformio.ini, add the library to the lib_deps field

[env:uno]
libdeps = IRremote
platform = atmelavr
board = uno
framework = arduino

Footnotes

  1. https://www.instructables.com/A-Way-to-Run-Arduino-Sketch-With-VSCode-PlatformIO/