This guide will outline how to begin coding and compiling using Visual Studio Code and PlatformIO instead of the ArduinoIDE.
Start with downloading the VSCode IDE for your operating system and get the PlatformIO extension added.
Once PIO is available you can get to the Platforms and Libraries tabs to begin adding support for our typical microcontrollers and to access the same libraries as found in the ArduinoIDE. We need support for the right platforms first, so we'll need to access PlatformIO and begin adding those.
- Select the PlatformIO tab on the left-hand panel
- Go to PIO Home > Platforms
- Install the following:
- Atmel AVR for Arduino Nano
- Atmel megaAVR for ATMega 2560
- Espressif 32 for ESP32
Before installing a library you'll need a project in context. Alternatively, once a project is configured with libraries they will be downloaded automatically and kept up to date per an associated platformio.ini file.
- Go to PIO Home > Libraries
- Search for the library you need to install
- Select the project for which the library is needed
Once associated with a project, all libraries will be downloaded by PlatformIO upon opening the project.
To compile a PlatformIO project via shell script, you will need the "pio" utility which can be installed via Python v3.11 or higher.
After installing Python3 run the following:
pip install platformio
If you need to upgrade pip that can be done using the following:
pip install --upgrade pip
Once the pio
utility is available, the included scripts in the project's .github/
folder may be used to compile code.