Use VS Code & Platformio to create complex projects on ESP32
This article explains how to install the Visual Studio Code software with the PlatformIO plugin to be able to program in the same software more than 400 development boards such as Arduino, ESP32, Nucleo, STM32, Teensy, Raspberry Pi boards.
Boards and libraries are automatically installed from the software.
Visual Studio Code is available on all platforms (Windows / MacOS / Linux).
Installing VS Code
To install Visual Studio Code on Windows , follow these steps:
-
Download the latest software version from the official website, by clicking “Download for Windows (Stable Build)”
-
Launch the .exe installation file, then after accepting the terms of the license agreement, you can choose the installation folder:

-
In the window on additional tasks, check at least the following boxes:

-
The installation is now complete, the VS Code welcome page is as follows:

-
VS Code defaults to English. To put it in French, you have to download a “French Language Pack” extension available in the plugin manager (last icon in the left menu).

Note
Even if VS Code can be put in French, PlatformIO remains in English .
-
Then VS Code must restart to change the language

Note
To change the language, you must click on Cogwheel> Command palette , type language in the command palette, then click on Change display language .


VS Code can be completely personalized, among other things you can change the theme.
Now that the text editor has been installed, PlatformIO must be installed to be able to program the boards.
PlatformIO
Installation on VS Code
-
The installation of the PlatformIO plugin is done directly in VS Code, from the plugin manager. Just type in the search bar PlatformIO , then click on Install .

-
If the installation was successful, a window prompting you to reload VS Code appears:

-
A new icon has been added to the left menu. We arrive on the PlatformIO home page:

The installation of PlatformIO is complete.
Configure PlatformIO for ESP32
So far, no platform (Arduino / ESP-IDF / STM32Cube) has been installed. All the necessary tools will be downloaded and installed when creating a project for a specific board.
To be able to program an ESP32 as on the Arduino IDE software (using the Arduino-ESP32 framework):
-
Create a new project by clicking on Projects> Create New Project

-
Then give your project a name, select an ESP32 board, for example the Espressif ESP32 Dev module board. You can then choose between the Arduino or ESP-IDF framework. Select Arduino to program the ESP32 in the same way as on the Arduino IDE.

-
Click on src> main.cpp in the drop-down menu on the left to start programming like on the Arduino IDE.

-
To be able to use the PSRAM of the uPesy Wrover Devkit board, you have to add in the configuration file platformio.ini
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
