PlatformIO – Crossplatform Alternate IDE for Arduino with auto-complete feature!

This post is intended to give step by step process for setting PlatformIO IDE which is the next-generation integrated development environment for IoT:

  • Cross-platform build system without external dependencies to the OS software:

    • 200+ embedded boards
    • 15+ development platforms
    • 10+ frameworks
  • C/C++ Intelligent Code Completion

  • C/C++ Smart Code Linter for rapid professional development

  • Library Manager for the hundreds popular libraries

  • Multi-projects workflow with multiple panes

  • Themes support with dark and light colors

  • Serial Port Monitor

  • Built-in Terminal with PlatformIO CLI tool (pio, platformio)

PlatformIO IDE is based on GitHub’s Atom source code editor that’s modern, approachable, yet hackable to the core; a tool you can customize to do anything but also use productively without ever touching a config file.

Installation Procedure

  1. Download and install the latest Atom text editor

  2. Open Atom Package Manager and install platformio-ide Atom package

    • Windows: Menu: File > Settings > Install
    • Linux: Menu: Edit > Preferences > Install

../_images/ide-atom-platformio-install.png

Quick Start

This tutorial introduces you to the basics of PlatformIO IDE workflow and shows you a creation process of a simple “Blink” example. After finishing, you will have a general understanding of how to work with projects in the IDE.

Launch

After installation, you launch PlatformIO IDE by opening Atom. Once Atom is open, PlatformIO IDE auto installer will continue to install dependent packages and PlatformIO CLI. Please be patient and let the installation complete. In the final result, PlatformIO IDE will ask you to reload Atom window to apply installed components. Please click on Reload Now. After it, PlatformIO IDE is ready for using. Happy coding!

Setting Up the Project

  1. To create a new project choose Menu: PlatformIO > Initialize new Project or update existingor press the corresponding icon in the PlatformIO toolbar as shown in the image below:

../_images/ide-atom-platformio-quick-start-1.png

  1. In the “New Project Menu” choose desired boards (more than one board is allowed) and select a project directory. Then press “Initialize” button:

../_images/ide-atom-platformio-quick-start-2.png

  1. If everything is fine, you should see the success message and project tree in the left panel:

../_images/ide-atom-platformio-quick-start-3.png

  1. Now, let’s create the first project source file: right-click on the folder src and choose New File:

../_images/ide-atom-platformio-quick-start-4.pngEnter filename main.cpp:

../_images/ide-atom-platformio-quick-start-5.pngCopy the next source code to the just created file main.cpp:

/**
 * Blink
 * Turns on an LED on for one second,
 * then off for one second, repeatedly.
 */
#include "Arduino.h"

void setup()
{
  // initialize LED digital pin as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  // wait for a second
  delay(1000);
  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
   // wait for a second
  delay(1000);
}

Process Project

PlatformIO IDE proposes different ways to process project (build, clean, upload firmware, run other targets) using:

../_images/ide-atom-platformio-quick-start-6.png

  1. Run Build and you should see green “success” result in the building panel:

../_images/ide-atom-platformio-quick-start-7.pngTo upload firmware to the board run Upload.

  1. What is more, you can run specific target or process project environment usingMenu: PlatformIO > Run other target... or call targets list from the status bar (bottom, left corner):

../_images/ide-atom-platformio-quick-start-8.pngAnd select the desired target:

../_images/ide-atom-platformio-quick-start-9.png

  1. To run built-in terminal interface choose Menu: PlatformIO > Terminal or press the corresponding icon in the PlatformIO toolbar:

../_images/ide-atom-platformio-quick-start-10.pngIt provides you fast access to all set of powerful PlatformIO CLI commands:

../_images/ide-atom-platformio-quick-start-11.png

  1. To run built-in “Serial Monitor” choose Menu: PlatformIO > Serial Monitor or press the corresponding icon in the PlatformIO toolbar:

../_images/ide-atom-platformio-quick-start-12.pngIt has several settings to adjust your connection:

../_images/ide-atom-platformio-quick-start-13.pngAnd allows you to communicate with your board in an easy way:

../_images/ide-atom-platformio-quick-start-14.png

 

 

Advertisements

3 thoughts on “PlatformIO – Crossplatform Alternate IDE for Arduino with auto-complete feature!

  1. Pingback: Using FreeRTOS with AVR | Random Codes - Elementz Tech Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s