Programming for Arduino? Use Platform.io instead of the Arduino IDE

For a fun side project recently, I started developing on a little Arduino HERO board by Inventr.io. Now that I’ve been programming professionally for a little while, I’ve grown accustomed to certain quality-of-life tools that help me program. The biggest one for me is probably the Vim plugin for VSCode. I use Vim constantly as I work and can’t imagine programming full time without it at this point. Using the Arduino IDE, I immediately realized that it didn’t have a Vim plugin or many other useful tools that you can use with VSCode. After a bit of digging, I found a solution to this problem.

You can use the Platform.io plugin to do tons of embedded programming in VSCode! This meant that I could continue using all of my plugins as I played around with the Arduino.

Setup

Here are the steps I took to get my project setup:

  1. Install the platform.io plugin for VSCode.
  2. Open the extension on the left sidebar and click the “New Project” button on the Home page.
  3. In this menu, name your project and select the “Arduino Uno” board.
  4. Click “Finish” to continue to your project

Running Programs

Once you have some code written that you’re ready to run on your board, press the “Serial Monitor” button in the top right of your VSCode window and your program should start executing.This is what the button looks like:

When you start your program, you should see the terminal open up and you may notice a “Serial Monitor” tab as well. This is where you can see any sensor information you might be printing out.

Extensions

Once you’ve been programming in your project for a while, you might get to a point where you will need to install some extensions. For example, I wanted to start playing around with a keypad and needed to install a specific library to properly interact with the one that came in my Arduino kit (this is the library I used in case anyone is wondering).

To do this:

  1. Open the Platform.IO icon on the right toolbar.
  2. Click the “Libraries” side item.
  3. Search the registry for whatever library you’re looking for and click “Install”

That should do it!

Using Platform.io

It took me a little digging to find this information, so I thought it would be helpful to put it out there! I hope this helps and that you continue to enjoy embedded programming!

Conversation

Join the conversation

Your email address will not be published. Required fields are marked *