Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PlatformIO: An Alternative Arduino IDE

DZone's Guide to

PlatformIO: An Alternative Arduino IDE

Here's an introduction to an alternative open-source Arduino IDE, PlatformIO.

· IoT Zone
Free Resource

When developing an Arduino sketch we mostly use Arduino IDE. But it's important to note that there are several alternative Arduino IDEs. In fact, these alternative IDEs are useful and can be more user-friendly.

Arduino IDE is the first IDE we all use when approaching Arduino development for the first time. It's simple and provides all the features to write, compile, and upload the code to Arduino boards. It is based on Java and runs on Windows, OS X, and Linux. Arduino IDE is a complete solution, but it does not have all the features you could find in Eclipse or IntelliJ.

I was looking for an Arduino alternative IDE that could provide a more "robust" IDE, but one that would still have all the features of Arduino IDE. This Arduino alternative IDE must be both free and open source. There are several options, but I focused my attention on PlatformIO.
PlatformIO is an interesting alternative IDE that provides almost all the features I was looking for.

First of all, it is open source — you can find the source code at their GitHub repository. Second, it is free to use. Third, it has a large community that supports it.

Arduino Alternative IDE: PlatformIO

This IDE has a clean and easy-to-use interface. It offers not only a visual IDE to develop IoT projects, but it has a CLI (Command Line Interface). It is based on Python and runs on different OSs, like Windows, OS X, and Linux.

The main features are:

  • C/C++ Code Completion.
  • Multi-project.
  • Theme support.
  • Cross-platform support.
  • Serial port monitor.
  • Library management system.
  • Continuous integration.

This Arduino alternative IDE supports several boards, such as Arduino UNO, Arduino MKR1000, and general Arduino development boards. Moreover, it supports the Raspberry Pi family as well. This is a complete solution to develop IoT projects in an easy and intuitive way. PlatformIO's interface is completely different compared to Arduino IDE, but it remains easy to use.

How to Build Your First Arduino Project

Now it's time to start using PlatformIO. The best way to test is to build a simple Arduino project. Implementing a simple project helps us to evaluate this IDE and, at the same time, we can check if it is a real improvement compared to Arduino IDE.

As a project, we will build a simple RGB LED controlled by Arduino. We won't cover the details of this project because we have already described it. What we want to verify is how we can build a project, how to upload it, and how easy it is using this IDE.

So, the first step is the installation process — very simple. Once the IDE is installed, let's run the app. It takes a while before you can use it because the IDE starts an update/installing process:

Image title

After this process is completed, you have PlatformIO up and running:

Image title

As you can see, the interface is very clean with all the most important commands on the left bar. We have several options:

  • Create a new project.
  • Open an existing project.
  • Import an Arduino Project.

In our case, we want to create a new project, so let's click on the first item. After inserting the required fields (like the board we are using), the project is ready. You can consider the project like a folder where you can put your project files. We create a simple test file (testLed.cpp), with this content:

Image title

The first thing you should notice is the code completion, which is a very useful feature. The syntax highlighting is also attractive and helps to emphasize language keywords.

Now it is time to build and run our simple sketch:

Image title

Arduino Libraries Management

One important aspect is library management. As you know, Arduino IDE has its own library management system, and you can use it to download libraries. PlatformIO has a different way to handle libraries. You can access it using the Library Manager. Before installing a library, you have to find the library ID using the library registry. Opening the lib web page, you find a search area where you should insert the library name you are looking for:

Image title

The result is shown below:

Image title

Now you have the library ID, which you use to install the library:

Image title

Of course, in this example, 19 is the library ID. With that, the library is ready to use, and now you know PlatformIO and how the basics work.

Topics:
arduino ,ide

Published at DZone with permission of Francesco Azzola, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}