2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								..  _ide_sublimetext: 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Sublime Text
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								============
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The `Sublime Text  <http://www.sublimetext.com/> `_  is a cross-platform text and source code editor, with a Python application programming interface (API). Sublime Text is proprietary software. Its functionality is extendable with plugins. Most of the extending packages have free-software licenses and are community-built and maintained. Sublime Text lacks graphical setting dialogues and is entirely configured by editing text files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								This software can be used with:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  all available :ref: `platforms` 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  all available :ref: `frameworks` 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Refer to the `Sublime Text Documentation  <http://docs.sublimetext.info/en/latest> `_ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								page for more detailed information.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  contents :: 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Integration
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								-----------
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-21 23:41:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								..  note :: 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    Please verify that folder where is located `` platformio ``  program is added
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    to `PATH (wiki)  <https://en.wikipedia.org/wiki/PATH_(variable)> `_  environment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    variable. See FAQ: :ref: `faq_troubleshooting_pionotfoundinpath` .
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Project Generator
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								^^^^^^^^^^^^^^^^^
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-26 22:55:59 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Since PlatformIO 2.0 you can generate Sublime Text compatible project using
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								:option: `platformio init --ide`  command. Please choose board type using
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								:ref: `cmd_boards`  command and run:
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  code-block ::  shell
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-26 22:55:59 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    platformio init --ide sublimetext --board %TYPE%
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Then import this project via `` Project > Open Project... ``  and specify root
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								directory where is located :ref: `projectconf` .
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Manual Integration
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								^^^^^^^^^^^^^^^^^^
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								Initial configuration
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								~~~~~~~~~~~~~~~~~~~~~
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								First of all, we need to create "New Build System" with name "PlatformIO"
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								from `` Menu: Tools > Build System > New Build System ``  and fill it like
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								described below:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  code-block ::  bash
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    {
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-26 22:55:59 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        "cmd": ["platformio", "--force", "run"],
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								        "working_dir": "${project_path:${folder}}",
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        "variants":
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        [
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                "name": "Clean",
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-25 21:45:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                "cmd": ["platformio", "--force", "run", "--target", "clean"]
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            },
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								                "name": "Upload",
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-25 21:45:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                "cmd": ["platformio", "--force", "run", "--target", "upload"]
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								            }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        ]
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Secondly, we need to select "PlatformIO" Build System from a list:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  image ::  ../_static/ide-sublime-text-platformio-newproject-2.png
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								After that, we can use the necessary commands from
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								`` Menu: Tools > Command Palette ``  or with `` Ctrl+Shift+P ``  (Windows/Linux)
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								`` Cmd+Shift+P ``  (Mac) shortcut.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  image ::  ../_static/ide-sublime-text-platformio-newproject-3.png
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Command Hotkeys
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								'''''''''''''''
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Sublime Text allows to bind own hotkey per command. Let's setup them
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								for PlatformIO commands using shortcut `` Menu: Preferences > Key-Bindings - User `` :
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  image ::  ../_static/ide-sublime-text-platformio-newproject-4.png
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								We are going to use these shortcuts:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  `` F11 ``  for clean project
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  `` F12 ``  for upload firmware to target device
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								In this case, the final code will look like:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  code-block ::  none
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    [
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { "keys": ["f11"], "command": "build", "args": {"variant": "Clean"} },
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        { "keys": ["f12"], "command": "build", "args": {"variant": "Upload"} }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    ]
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								First program in Sublime Text
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Simple "Blink" project will consist from two files:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								1.  Main "C" source file named `` main.c ``  must be located in the `` src ``  directory.
 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Let's create new file named `` main.c ``  using `` Menu: File > New File ``  or shortcut `` Ctrl+N ``  (Windows/Linux) `` Cmd+N ``  (Mac) with the next contents:
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  code-block ::  c
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    #include "Arduino.h"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    #define WLED    13  // Most Arduino boards already have an LED attached to pin 13 on the board itself
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void setup()
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      pinMode(WLED, OUTPUT);  // set pin as output
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void loop()
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    {
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      digitalWrite(WLED, HIGH);  // set the LED on
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      delay(1000);               // wait for a second
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      digitalWrite(WLED, LOW);   // set the LED off
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								      delay(1000);               // wait for a second
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    }
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								2.  Project Configuration File named `` platformio.ini ``  must be located in the project root directory.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Copy the source code which is described below to it.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  code-block ::  none
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    #
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # Project Configuration File
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    #
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # A detailed documentation with the EXAMPLES is located here:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # http://docs.platformio.org/en/latest/projectconf.html
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    #
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # A sign `#`   at the beginning of the line indicates a comment
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    # Comment lines are ignored.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    [env:arduino_uno]
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    platform = atmelavr
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    framework = arduino
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    board = uno
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Conclusion
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								----------
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-22 21:05:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Taking everything into account, we can open project directory in Sublime Text using `` Menu: File > Open Folder ``  and build it with shortcut `` Ctrl+B ``  (Windows/Linux) or `` Cmd+B ``  (Mac), clean project with shortcut `` F11 ``  and upload firmware to target with shortcut `` F12 `` .
 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-25 20:43:30 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								..  image ::  ../_static/ide-sublime-text-platformio-newproject-5.png