2016-01-01 20:51:48 +02:00
.. Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
2015-11-18 17:33:46 +02:00
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2015-07-23 19:25:10 +03:00
.. _ide_atom:
2016-01-24 00:44:18 +02:00
PlatformIO IDE for Atom
=======================
2015-07-23 19:25:10 +03:00
2016-01-31 01:13:06 +02:00
PlatformIO IDE is the next generation integrated development environment for IoT:
2015-07-23 19:25:10 +03:00
2016-03-03 16:39:58 +02:00
* Cross-platform build system without external dependencies to the OS software:
2015-07-23 19:25:10 +03:00
2016-01-24 00:44:18 +02:00
- 200+ embedded boards
- 15+ development platforms
- 10+ frameworks
2016-02-22 01:23:55 +02:00
* C/C++ Intelligent Code Completion
* C/C++ Smart Code Linter for rapid professional development
2016-01-25 23:43:11 +02:00
* Library Manager for the hundreds popular libraries
2016-01-31 01:13:06 +02:00
* Multi-projects workflow with multiple panes
* Themes support with dark and light colors
2016-01-30 13:41:46 +02:00
* Serial Port Monitor
2016-01-31 01:13:06 +02:00
* Built-in Terminal with :ref: `PlatformIO CLI <userguide>` tool (`` pio `` , `` platformio `` )
2015-07-23 19:25:10 +03:00
2016-02-20 01:06:25 +02:00
2016-01-31 01:13:06 +02:00
PlatformIO IDE is based on GitHub's `Atom <https://atom.io> `_ source
2016-02-01 00:18:04 +02:00
code editor that's modern, approachable, yet hackable to the core; a tool you
2016-01-31 01:13:06 +02:00
can customize to do anything but also use productively without ever touching a
config file.
2016-01-24 01:14:01 +02:00
2016-01-25 01:05:54 +02:00
2015-07-23 19:25:10 +03:00
.. contents ::
2016-01-24 00:44:18 +02:00
Installation
------------
2016-01-06 16:52:22 +02:00
2016-02-19 21:54:20 +02:00
PlatformIO IDE is the next generation integrated development environment for IoT.
It's built on top of `GitHub's Atom "hackable" text editor <https://atom.io> `_ .
If you have already Atom installed, please install `PlatformIO IDE for Atom package <https://atom.io/packages/platformio-ide> `_ .
2016-01-25 01:05:54 +02:00
2016-02-19 21:54:20 +02:00
Automatic Installation
~~~~~~~~~~~~~~~~~~~~~~
Please download PlatformIO IDE for Atom bundle with built-in auto installer
(be patient and let the installation complete)
2016-02-27 00:36:48 +02:00
- `Download PlatformIO IDE for Windows <https://dl.bintray.com/platformio/ide-bundles/platformio-atom-windows.exe> `_
- `Download PlatformIO IDE for Mac <https://dl.bintray.com/platformio/ide-bundles/platformio-atom-mac.zip> `_
- `Download PlatformIO IDE .deb <https://dl.bintray.com/platformio/ide-bundles/platformio-atom-linux-x86_64.deb> `_
- `Download PlatformIO IDE .rpm <https://dl.bintray.com/platformio/ide-bundles/platformio-atom-linux-x86_64.rpm> `_
2016-02-19 21:54:20 +02:00
Manual Installation
~~~~~~~~~~~~~~~~~~~
1. Download and install the latest Atom text editor
- `Download Atom for Mac <https://atom.io/download/mac> `_
- `Download Atom for Windows <https://atom.io/download/windows> `_
- `Download Atom .deb <https://atom.io/download/deb> `_
- `Download Atom .rpm <https://atom.io/download/rpm> `_
2016-01-29 23:52:14 +02:00
- `Other platforms <https://github.com/atom/atom/releases/latest> `_
2016-01-25 01:05:54 +02:00
2016-02-22 01:23:55 +02:00
2. Open Atom Package Manager and install `platformio-ide <https://atom.io/packages/platformio-ide> `_ Atom package
2016-01-06 16:52:22 +02:00
2016-01-29 23:52:14 +02:00
- **Mac OS X** : `` Menu: Atom > Preferences > Install ``
- **Windows** : `` Menu: File > Settings > Install ``
- **Linux** : `` Menu: Edit > Preferences > Install ``
2016-01-25 01:05:54 +02:00
2016-01-29 23:52:14 +02:00
.. image :: ../_static/ide-atom-platformio-install.png
2016-01-06 16:52:22 +02:00
2016-03-02 22:01:21 +02:00
.. _atom_ide_quickstart:
2016-03-02 01:42:00 +02:00
Quick Start
-----------
2016-02-26 20:18:38 +02:00
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.
Launching
~~~~~~~~~
2016-02-26 23:26:20 +02:00
PlatformIO IDE is built on top of GitHub's Atom "hackable" text editor.
2016-03-02 01:42:00 +02:00
After installation please run one of `` Atom.exe `` , `` Atom.app `` or `` atom ``
2016-02-26 23:26:20 +02:00
application depending on the OS.
2016-02-26 20:18:38 +02:00
Setting Up the Project
~~~~~~~~~~~~~~~~~~~~~~
1. To create a new project choose `` Menu: PlatformIO > Initialize new Project or update existing `` or press the corresponding icon in the PlatformIO toolbar as shown in the image below:
.. image :: ../_static/ide-atom-platformio-quick-start-1.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-1.png
2. In the "New Project Menu" choose desired boards (more than one board is allowed) and select a project directory. Then press "Initialize" button:
.. image :: ../_static/ide-atom-platformio-quick-start-2.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-2.png
3. If everything is fine, you should see the success message and project tree in the left panel:
.. image :: ../_static/ide-atom-platformio-quick-start-3.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-3.png
4. Now, let's create the first project source file: right-click on the folder `` src `` and choose `` New File `` :
.. image :: ../_static/ide-atom-platformio-quick-start-4.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-4.png
Enter filename `` main.cpp `` :
.. image :: ../_static/ide-atom-platformio-quick-start-5.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-5.png
Copy the next source code to the just created file `` main.cpp `` :
.. code-block :: 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:
- :ref: `atom_ide_platformio_toolbar`
- :ref: `atom_ide_platformio_menu`
- :ref: `ide_atom_building_targets` and hotkeys
.. image :: ../_static/ide-atom-platformio-quick-start-6.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-6.png
5. Run `` Build `` and you should see green "success" result in the building
panel:
.. image :: ../_static/ide-atom-platformio-quick-start-7.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-7.png
To upload firmware to the board run `` Upload `` .
2016-02-26 23:26:20 +02:00
6. What is more, you can run specific target or process project environment
2016-02-26 20:18:38 +02:00
using `` Menu: PlatformIO > Run other target... ``
or call targets list from the status bar (bottom, left corner):
.. image :: ../_static/ide-atom-platformio-quick-start-8.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-8.png
And select desired target:
.. image :: ../_static/ide-atom-platformio-quick-start-9.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-9.png
7. To run built-in terminal interface choose `` Menu: PlatformIO > Terminal `` or press the corresponding icon in the PlatformIO toolbar:
.. image :: ../_static/ide-atom-platformio-quick-start-10.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-10.png
It provides you fast access to all set of powerful PlatformIO CLI commands:
.. image :: ../_static/ide-atom-platformio-quick-start-11.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-11.png
8. To run built-in "Serial Monitor" choose `` Menu: PlatformIO > Serial Monitor `` or press the corresponding icon in the PlatformIO toolbar:
.. image :: ../_static/ide-atom-platformio-quick-start-12.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-12.png
It has several settings to adjust your connection:
.. image :: ../_static/ide-atom-platformio-quick-start-13.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-13.png
And allows you to communicate with your board in an easy way:
.. image :: ../_static/ide-atom-platformio-quick-start-14.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio-quick-start-14.png
2016-01-24 00:44:18 +02:00
User Guide
----------
2016-01-06 16:52:22 +02:00
2016-02-26 20:18:38 +02:00
.. _atom_ide_platformio_menu:
2016-01-25 01:05:54 +02:00
Menu item `` PlatformIO ``
~~~~~~~~~~~~~~~~~~~~~~~~
2016-01-24 17:19:59 +02:00
`platformio-ide <https://atom.io/packages/platformio-ide> `_ package adds to Atom
new menu item named `` Menu: PlatformIO `` (after `` Menu: Help `` item).
2016-01-25 01:05:54 +02:00
.. image :: ../_static/ide-atom-platformio-menu-item.png
2016-02-26 20:18:38 +02:00
.. _atom_ide_platformio_toolbar:
2016-01-29 23:52:14 +02:00
PlatformIO Toolbar
~~~~~~~~~~~~~~~~~~
PlatformIO IDE Toolbar contains the quick access button to the popular commands.
Each button contains hint (delay mouse on it).
.. image :: ../_static/ide-atom-platformio-toolbar.png
* PlatformIO: Build
2016-01-30 13:41:46 +02:00
* PlatformIO: Upload
2016-01-29 23:52:14 +02:00
* PlatformIO: Clean
2016-01-31 01:13:06 +02:00
* ||
2016-02-19 21:54:20 +02:00
* Initialize new PlatformIO Project or update existing...
2016-01-29 23:52:14 +02:00
* Add/Open Project Folder...
* Find in Project...
2016-01-31 01:13:06 +02:00
* ||
2016-01-29 23:52:14 +02:00
* Terminal
2016-02-19 21:54:20 +02:00
* Library Manager
2016-01-29 23:52:14 +02:00
* Serial Ports
* Serial Monitor
2016-01-31 01:13:06 +02:00
* ||
2016-01-29 23:52:14 +02:00
* Settings
* PlatformIO Documentation
2016-01-30 13:41:46 +02:00
.. _ide_atom_building_targets:
2016-01-29 23:52:14 +02:00
Building / Uploading / Targets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-07-23 19:25:10 +03:00
2016-01-24 00:44:18 +02:00
* `` cmd-alt-b `` / `` ctrl-alt-b `` / `` f9 `` builds project without auto-uploading.
* `` cmd-alt-u `` / `` ctrl-alt-u `` builds and uploads (if no errors).
* `` cmd-alt-c `` / `` ctrl-alt-c `` cleans compiled objects.
* `` cmd-alt-t `` / `` ctrl-alt-t `` / `` f7 `` run other targets (Upload using Programmer, Upload SPIFFS image, Update platforms and libraries).
* `` cmd-alt-g `` / `` ctrl-alt-g `` / `` f4 `` cycles through causes of build error.
* `` cmd-alt-h `` / `` ctrl-alt-h `` / `` shift-f4 `` goes to the first build error.
* `` cmd-alt-v `` / `` ctrl-alt-v `` / `` f8 `` toggles the build panel.
* `` escape `` terminates build / closes the build window.
2015-12-02 23:51:07 +02:00
2016-01-24 00:44:18 +02:00
More details `Atom Build package <https://atom.io/packages/build> `_ .
2015-12-02 23:51:07 +02:00
2016-02-19 21:54:20 +02:00
Intelligent Code Autocompletion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-12-02 23:51:07 +02:00
2016-02-19 21:54:20 +02:00
PlatformIO IDE uses `clang <http://clang.llvm.org> `_ for the Intelligent Code Autocompletion.
2016-01-25 23:43:11 +02:00
To check that `` clang `` is available in your system, please open
2016-01-24 00:44:18 +02:00
Terminal and run `` clang --version `` . If `` clang `` is not installed, then install it:
2015-07-23 19:25:10 +03:00
2016-01-24 00:44:18 +02:00
- **Mac OS X** : Install the latest Xcode along with the latest Command Line Tools
(they are installed automatically when you run `` clang `` in Terminal for the
first time, or manually by running `` xcode-select --install ``
- **Windows** : Download the latest `Clang for Windows <http://llvm.org/releases/download.html> `_ .
2016-01-26 01:18:33 +02:00
Please select "Add LLVM to the system PATH" option on the installation step.
2016-01-24 00:44:18 +02:00
- **Linux** : Using package managers: `` apt-get install clang `` or `` yum install clang `` .
- **Other Systems** : Download the latest `Clang for the other systems <http://llvm.org/releases/download.html> `_ .
2015-07-23 19:25:10 +03:00
2016-01-25 23:43:11 +02:00
.. warning ::
2016-01-29 23:52:14 +02:00
The libraries which are added/installed after initializing process will
not be reflected in code linter. You need `` Menu: PlatformIO >
Rebuild C/C++ Project Index (Autocomplete, Linter)`` .
2016-01-25 23:43:11 +02:00
2016-02-19 21:54:20 +02:00
.. _ide_atom_smart_code_linter:
Smart Code Linter
~~~~~~~~~~~~~~~~~
2015-07-23 19:25:10 +03:00
2016-02-22 01:23:55 +02:00
PlatformIO IDE uses PlatformIO's pre-built GCC toolchains for Smart Code Linter
and rapid professional development.
The configuration data are located in `` .gcc-flags.json `` . This file will be
2016-01-29 23:52:14 +02:00
automatically created and preconfigured when you initialize project using
2016-02-19 21:54:20 +02:00
`` Menu: PlatformIO > Initialize new PlatformIO Project or update existing... `` .
2015-07-23 19:25:10 +03:00
2016-01-25 23:43:11 +02:00
.. warning ::
2016-01-29 23:52:14 +02:00
The libraries which are added/installed after initializing process will
not be reflected in code linter. You need `` Menu: PlatformIO >
Rebuild C/C++ Project Index (Autocomplete, Linter)`` .
.. error ::
If you have error like `` linter-gcc: Executable not found `` and
`` "***/.platformio/packages/toolchain-atmelavr/bin/avr-g++" not found ``
2016-02-19 21:54:20 +02:00
please `` Menu: PlatformIO > Initialize new PlatformIO Project or update existing... `` .
2016-01-25 01:05:54 +02:00
Install Shell Commands
~~~~~~~~~~~~~~~~~~~~~~
To install `` platformio `` and `` pio `` shell commands please use `` Menu:
PlatformIO > Install Shell Commands`` . It will allow you to call PlatformIO from
2016-01-29 23:52:14 +02:00
other process, terminal and etc.
2016-01-26 13:52:40 +02:00
2016-01-25 23:43:11 +02:00
Known issues
2016-02-19 21:54:20 +02:00
------------
Smart Code Linter is disabled for Arduino files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:ref: `ide_atom_smart_code_linter` is disabled by default for Arduino files
(`` *.ino `` and `` .pde `` ) because they are not valid C/C++ based
source files:
1. Missing includes such as `` #include <Arduino.h> ``
2. Function declarations are omitted.
There are two solutions:
2016-02-20 01:06:25 +02:00
.. contents ::
:local:
.. _ide_atom_knownissues_sclarduino_manually:
2016-02-19 21:54:20 +02:00
Convert Arduino file to C++ manually
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For example, we have the next `` Demo.ino `` file:
2016-02-27 00:36:48 +02:00
.. code-block :: cpp
2016-02-19 21:54:20 +02:00
void function setup () {
someFunction(13);
}
void function loop() {
delay(1000);
}
void someFunction(int num) {
}
Let's convert it to `` Demo.cpp `` :
2016-02-20 01:06:25 +02:00
1. Add `` #include <Arduino.h> `` at the top of the source file
2016-02-19 21:54:20 +02:00
2. Declare each custom function (excluding built-in, such as `` setup `` and `` loop `` )
before it will be called.
The final `` Demo.cpp `` :
2016-02-27 00:36:48 +02:00
.. code-block :: cpp
2016-02-19 21:54:20 +02:00
#include <Arduino.h>
void someFunction(int num);
void function setup () {
someFunction(13);
}
void function loop() {
delay(1000);
}
2016-01-25 23:43:11 +02:00
2016-02-19 21:54:20 +02:00
void someFunction(int num) {
}
2016-02-20 01:06:25 +02:00
Force Arduino file as C++
^^^^^^^^^^^^^^^^^^^^^^^^^
To force Smart Code Linter to use Arduino files as C++ please
2016-02-22 01:23:55 +02:00
1. Open `` .gcc-flags.json `` file from the Initialized/Imported project and add
`` -x c++ `` flag at the beginning of the value of `` gccDefaultCppFlags `` field:
2016-02-20 01:06:25 +02:00
.. code-block :: json
{
"execPath": "...",
2016-02-22 01:23:55 +02:00
"gccDefaultCFlags": "...",
"gccDefaultCppFlags": "-x c++ -fsyntax-only ...",
2016-02-20 01:06:25 +02:00
"gccErrorLimit": 15,
"gccIncludePaths": "...",
"gccSuppressWarnings": false
}
2. Perform all steps from :ref: `ide_atom_knownissues_sclarduino_manually`
(without renaming to `` .cpp `` ).
2016-02-26 23:26:20 +02:00
Articles / Manuals
------------------
2016-03-02 01:42:00 +02:00
* Feb 28, 2016 - **Alex Bloggt** - `PlatformIO vorgestellt (Introduction to PlatformIO IDE, German) <https://alexbloggt.com/platformio-vorgestellt/> `_
2016-03-04 15:51:42 +02:00
* Mar 04, 2016 - **Ricardo Vega** - `Programa tu Arduino desde Atom (Program your Arduino from Atom, Spanish) <http://ricveal.com/blog/programa-arduino-desde-atom/> `_
2016-03-02 01:42:00 +02:00
* Feb 25, 2016 - **NutDIY** - `PlatformIO Blink On Nodemcu Dev Kit V1.0 (Thai) <http://nutdiy.blogspot.com/2016/02/platformio-blink-on-nodemcu-dev-kit-v10.html> `_
2016-02-26 23:26:20 +02:00
See a full list with :ref: `articles` .
2016-03-02 01:42:00 +02:00
Screenshot
----------
.. image :: ../_static/ide-atom-platformio.png
:target: http://docs.platformio.org/en/latest/_images/ide-atom-platformio.png