Best Arduino IDE for efficient programming

Intro

PlatformIO is an IDE built on top of other IDE, in other words, PlatformIO is a Plugin for a various source-code editor or IDE like Visual Studio Code, Atom, Eclipse, Visual Studio, and some more.

Setting up PlatformIO is somewhat simple, maybe little more complex than Arduino IDE (just some setup is required for boards other than Arduino 🙂 ).

Steps overview:

  1. Download Visual Studio Code.
  2. Install PlatformIO extension.
  3. Create a new project for a specific board.
  4. Configure to include external libraries.
  5. Enjoy

Note: We can do this by Atom also, but for code completion, it requires other software to be installed(in Windows) and also it’s little slower than VSCode (Visual Studio Code).

Why Use PlatformIO on Visual Studio Code

  • Visual Studio Code is very flexible Code-Editor, it can be used as full-fledged IDE for almost any programming language like python, C/C++, Javascript, Java and more things like Web Development, etc.
  • PlatformIO is a full-fledged IDE for many development boards and MCUs, like Arduino boards, ESP8266 based boards, Raspberry Pi and more.
  • It has a total of 600+ supported boards at the time of writing this article.
  • Basic features like Code completion, definition peeking of function or method.
  • Project management, external library updater, debugging, unit testing.
  • Cross-platform.
  • Visual Studio Code opens a lot faster than the Arduino IDE.
    In my laptop Vscode opens in 5 seconds and Arduino IDE 15 seconds.

1. Download Visual Studio Code

Visual Studio Code is a source code editor software, or you can say an advanced text editor which can be used as in IDE or Code-editor.

So just download and install from here. And install 😐 .

2. Install PlatformIO Extension

Installing PlatformIO extension in VSCode

It will take a couple of minutes, you may see terminal at the lower screen in VSCode saying displaying PlatformIO installation, Don’t close the VSCode at this time. Like This,

PlatformIO installation in progress in VSCode

After that create a project.

PlatformIO Home page in VSCode

For example, if you don’t know what Framework to choose, select Arduino.

You can change the location of the project, but for I chosen Default for simplicity. 🙂

PlatformIO Project Wizard, to create new project

3. Understand PlatformIO Basics

PlatformIO is a lot a better than Arduino IDE and of course it’s somewhat complex.

Folder Structure

Unlike Arduino where main file name (.ino) must be in a folder named same as the main file.

Folder Structure of PlatformIO is:-

PlatformIO Project directory structure
VSCode platformIO Directory view in a project

Let’s Understand these files/folders

lib

Put external libraries here, just like you put libraries downloaded from the internet in Arduino Library Folder.

But these libraries will be limited to that project only, we will fix this later next section.

platformio.ini

Configuration for the current project. Here you can define folder location to external libraries, add this line to it,

lib_extra_dirs = C:\example_folder\lib

Reference: Read More here

Where folder C:\example_folder\lib is the folder where the folder of libraries exists. Then add above line to every PlatformIO project you create, so it will be visible to all the projects you want.

OR, you can just also put libraries in “C:\Users\user_name\.platformio\lib“, no need to change platformio.ini.

src

The main file to compile and upload will be here.
Also called source folder.

main.cpp

The main file where you will write your Arduino code.

It’s in .cpp extension not .ino because some IDE don’t support .ino files as it’s not valid C/C++ file.

Read More.

What Next

In I will tell how to configure PlatformIO for NodeMCU with OTA Update feature.

Thanks for Reading, Share the joy with friends if you like the post.

Aakash Kumar

This is Aakash Kumar, most of the time just gone in playing with those little modules. Most of them got burned, blasted and some got passed through my intestines. Interested in embedded systems, gaming, and electronics, pursuing B.Tech. in Electronics and Communication Engineering and still in a play.

Leave a Reply

Close Menu