# PlatformIO Guide

### About

PlatformIO is a versatile, open-source ecosystem designed for embedded development, providing a unified platform for building, managing, and debugging firmware across a wide range of microcontroller architectures. Integrated with popular IDEs like VSCode and Atom, it offers powerful tools for code editing, dependency management, and cross-compilation. PlatformIO simplifies the development process with its rich library ecosystem, support for multiple frameworks, and seamless integration with version control systems, making it an invaluable tool for both hobbyists and professionals in the embedded systems community.

### Install PlatformIO

#### 1\. Install VScode

If you haven't already, install VSCode on your machine. [Download Here](https://code.visualstudio.com/download)

#### 2\. Install PlatformIO Extension

After you've finished installing and setting up **VSCode**, open the **Extensions** menu, search for **PlatformIO**, and then install it.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-hkx0svho.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725091869668.png)

  

### Creating A New Project

#### 1\. Open the Projects & Configurations Tab

Open the **PlatformIO** menu. Then, within the **Quick Access** tab, select the **Projects & Configuration**s tab.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-sgmjnwgh.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725091985813.png)

#### 2\. Click Create New Project and Follow the Project Wizard

Click the **Create New Project** button, then fill out the required fields for the project.

First, set the name of the project.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-ownwcqeb.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725092300014.png)

Second, choose the board you want to use. In this example it will be **DOIT ESP32 DEVKIT V1**

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-q80utss8.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725092411197.png)

Third, choose which framework you want to develop in. In this example, it will be the default choice, which is the **Arduino** framework.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-sboyileh.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725092499290.png)

_**(Optional)**_ Uncheck the **Use default location** checkbox and choose the project location.

Navigate through your file system and choose a folder.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-tqum4omr.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725092670242.png)

Lastly, click **Finish**

#### 3\. Open the Created Project

The project should be opened automatically, but if not, open it in the **Projects & Configuration**s tab, similar to step 1.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-yygi1fya.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725108822028.png)

Once the project is opened. Navigate to src/main.cpp file via the **Explorer** tab.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-xodceu0i.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725108936163.png)

And done. This main.cpp file will be where you'll be coding your project, similar to a .ino file in the Arduino IDE.

### Choosing Ports

By default, PlatformIO automatically chooses the correct port to upload your code to your board. Most of the time, it works. But if it doesn't work or maybe you have 2 or more boards connected, here's how you can choose the port of your active board.

#### 1\. Click the Port Button

Click the **Set upload/monitor/test port** button at the bottom.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-6x0moc26.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725109838911.png)

#### 2\. Select an Active Port

Choose the port connected to your machine. Its most likely described as either **CP210x** or **CH340**.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-xsacjvxl.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725109939037.png)

### Choosing a Project Environtment

If you have more that 1 project, you need to choose a default project so that PlatformIO knows which project are you currently working on.

#### 1\. Choose the Project Button

Click the **Switch PlatformIO Project Environtment** button at the bottom.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-sp6mxawd.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725110279158.png)

#### 2\. Choose a Project

Choose the project you want to work on. Utilize the search feature to ease your searching.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-hgrxl1tz.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725110351600.png)

### Uploading Code

Make sure that your port and project environtment is configured properly. Follow the steps above if you haven't done this already.

#### 1\. Click the Upload Button

Click the Upload Button

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-gpbvmamy.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725110582312.png)

#### 2\. Hold the Boot Button on ESP32 if using an ESP32

Wait for your code to be compiled first. Then, when the **connecting........** appears, hold the boot button on the ESP32 until the uploading process is complete.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-pzeez4dc.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725110750391.png)

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-jizo6ewm.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725110797679.png)

### Serial Monitor

#### 1\. Configure the Serial Baud Rate

Navigate to the **platformio.ini** file within your project. Then, add the line

    monitor_speed = [Your baud rate]
    

Example :

    monitor_speed = 115200
    

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-y6h4pyii.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725111379396.png)

#### 2\. Click the Serial Monitor Button

Wait for the project to update, then click the **Serial Monitor** button.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-oxkazf0m.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725111700684.png)

### Installing Libraries

You can install any library from PlatformIO.

#### 1\. Open the Libraries Page

Click the PlatformIO button, then open the **Libraries** Page

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-mqq5sbxu.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725111895158.png)

#### 2\. Search for a Library

Search for the Library you need

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-g5jmfvsu.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112099312.png)

#### 3\. Add to Project

Click the **Add to Project** button. From this page, you can also view code examples, link to github repo, etc.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-grv7bytz.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112162085.png)

#### 4\. Choose Project

Choose the project you want to add the library. Then, click **Add**

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-spm7nfms.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112259311.png)

#### 5\. Check the .ini File

Check if the lib\_deps line is added. Save the file (Ctrl + S) if your file doesn't autosave.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-recnw8ep.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112343105.png)

#### 6\. Press the Build Button

Build the project so you can have code auto-completion.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-co4xadf1.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112591439.png)

#### 7\. Include the Project

Include the header file and you code auto-completion should work. Then, you can freely use the libary.

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-7ryd7llr.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112632568.png)

[![](https://learn.digilabdte.com/uploads/images/gallery/2025-08/embedded-image-jlml2rpz.png)](https://learn.digilabdte.com/uploads/images/gallery/2024-08/image-1725112956005.png)