Introduction
Sometimes you may want to connect 2 microcontrollers to a computer. In this case, you have to manually select a different serial port to upload code on each microcontroller because, by default, PlatformIO handles port selection automatically. Or you may want to change the baud rate (upload speed) in PlatformIO.
This tutorial will walk you through the process of selecting ports and changing the baud rate in PlatformIO.
Port Selection in PlatformIO
Here are two methods for selecting ports in PlatformIO.
Method 1: Main Window
1. Open the project in Platform-IO and Vs Code.
2. Click on “Auto” as shown below (red arrow).
3. After clicking on “Auto,” you will see that Platform-IO is normally in Auto mode (image above). Here, you can select the desired port from the serial ports connected to your computer.
Method 2: Platformio.ini File
1. Open the platformio.ini file from the test section.
2. Select your desired serial port by writing the “upload-port” command (image below).
Changing Baud Rate in PlatformIO
To change the baud rate, follow these steps:
1. Enter the platformio.ini file again.
2. Use the “monitor_speed” command to change the baud rate based on the image below.