Tech Tips

  1. Programming
  2. 19 view

How to Upload Program to Arduino Using PlatformIO IDE for VSCode

When you want to upload a program to Arduino, I think you’ll use Arduino IDE. When I tried to run FreeRTOS on M5Stack, I forgot but Arduino IDE didn’t work as I expected. But, PlatformIO IDE for VSCode worked. At that time, it’s difficult to find articles how to use PlatformIO IDE for VSCode for me. So, I’ll leave this article as my note. This article explains how to light the LED on Arduino UNO. Please connect Arduino UNO to PC beforehand.

Contents

Install PlatformIO IDE for VSCode

Please find “PlatformIO IDE” from VSCode extentions and install.
PlatformIO IDE will be appeared on activity bar after install.

Creating New Project on PlatformIO IDE for VSCode

Please select “Open” under “PIO Home” from “QUICK ACCESS”.
Please click “Create New Project” after selecting “Projects” on PIO Home.
Project Wizard will open, then please input project name / board / framework. After that, please click “Finish” button to create new project.

Upload program to Arduino UNO

Please write code in src/main.cpp.

#include <Arduino.h>

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}

Please push “Build” button after writing a program.
You can see build result in opened terminal after clicking “Build” button.
Please push “Upload” button after completing build.
You can see upload result from opened terminal.

Result

Now you can see lighting LED (near “L”) on Arduino UNO.

Programming recent post

  1. How to Upload Program to Arduino Using Platfo…

  2. How to avoid GPG error when using ROS Docker …

  3. Trying to Develop Visited Countries Colored M…

関連記事

PAGE TOP