{"id":67787,"date":"2018-07-21T08:09:02","date_gmt":"2018-07-21T08:09:02","guid":{"rendered":"http:\/\/randomnerdtutorials.com\/?p=67787"},"modified":"2020-05-15T15:16:23","modified_gmt":"2020-05-15T15:16:23","slug":"programming-esp32-with-atom-text-editor-and-platformio-ide","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/programming-esp32-with-atom-text-editor-and-platformio-ide\/","title":{"rendered":"Programming ESP32 with Atom Text Editor and PlatformIO IDE"},"content":{"rendered":"<p>In our <a href=\"https:\/\/randomnerdtutorials.com\/category\/projects\/esp32\/\">ESP32 projects and tutorials<\/a>, we recommend using the Arduino IDE to program the ESP32 development board. However, in some Windows computers it&#8217;s a bit tricky to install the ESP32 add-on using Git GUI due to permission errors, Arduino IDE version, or multiple Arduino IDE installations.<!--more--><\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-67882 size-full\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1200\" height=\"675\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p>There&#8217;s also another popular method to program ESP32 development boards using the <a href=\"https:\/\/atom.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Atom text editor<\/a> combined with\u00a0<a href=\"https:\/\/platformio.org\/platformio-ide\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE<\/a>. With this method you can still use the same programming language you use on Arduino IDE.<\/p>\n<p>This next tutorial was tested on a Windows 10 PC and on a Mac OS X computer.<\/p>\n<h2>1. Installing Atom Text Editor<\/h2>\n<p>The first step is to go to <a href=\"https:\/\/atom.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Atom.io<\/a>\u00a0website and download the free text editor.<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-67796\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom_desktop.png?resize=1107%2C634&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1107\" height=\"634\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom_desktop.png?w=1107&amp;quality=100&amp;strip=all&amp;ssl=1 1107w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom_desktop.png?resize=300%2C172&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom_desktop.png?resize=768%2C440&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom_desktop.png?resize=1024%2C586&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1107px) 100vw, 1107px\" \/><\/p>\n<p>After that, open the downloaded installation file and run it. The installation is pretty straightforward. Complete the on-screen instructions to finish the Atom installation.<\/p>\n<h2>2a. Installing Python 2.7.X on a Windows PC<\/h2>\n<p>In order to use PlatformIO IDE and program your ESP32 boards, you must have Python 2.7.X installed on your computer. Go to the <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python downloads<\/a> page and download the latest version of Python 2.7.X for your OS (Operating System).<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" class=\"aligncenter size-full wp-image-67793\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python_version.png?resize=1132%2C312&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1132\" height=\"312\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python_version.png?w=1132&amp;quality=100&amp;strip=all&amp;ssl=1 1132w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python_version.png?resize=300%2C83&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python_version.png?resize=768%2C212&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python_version.png?resize=1024%2C282&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1132px) 100vw, 1132px\" \/><\/p>\n<p><strong>Note:<\/strong> for this Unit, we&#8217;ve used Python 2.7.15. Any other Python 2.7.X version should also work.<\/p>\n<p>Open the downloaded file to start the Python installation wizard. During step 2, follow these next instructions:<\/p>\n<ul>\n<li>Scroll down through the &#8220;<strong>Customize Python 2.7.15<\/strong>&#8221; window;<\/li>\n<li>Open the &#8220;<strong>Add python.exe to Path<\/strong>&#8220;;<\/li>\n<li>And select the option &#8220;<strong>Will be installed on local hard drive<\/strong>&#8220;.<\/li>\n<\/ul>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67808\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python27.png?resize=591%2C427&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"591\" height=\"427\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python27.png?w=591&amp;quality=100&amp;strip=all&amp;ssl=1 591w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/python27.png?resize=300%2C217&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>After that, press &#8220;<strong>Next<\/strong>&#8221; button to complete the installation. After installing Python 2.7.X, you need to open the &#8220;<strong>Command Prompt<\/strong>&#8220;:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67801\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd-open.png?resize=388%2C155&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"388\" height=\"155\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd-open.png?w=388&amp;quality=100&amp;strip=all&amp;ssl=1 388w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd-open.png?resize=300%2C120&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd-open.png?resize=250%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 250w\" sizes=\"(max-width: 388px) 100vw, 388px\" \/><\/p>\n<p>Run the next sequence of commands to check the Python and pip version installed:<\/p>\n<pre><strong>python --version<\/strong>\nPython 2.7.15\n<strong>pip --version<\/strong>\npip 9.0.3<\/pre>\n<p>Both commands should return a similar output (the version might be slighter different in your case). After that, check if you have <em>virtualenv<\/em> installed:<\/p>\n<pre><strong>virtualenv --version<\/strong><\/pre>\n<p>If it&#8217;s already installed, you can go to the next section. Otherwise, you need to install it with this command:<\/p>\n<pre><strong>pip install virtualenv<\/strong><\/pre>\n<p>After that, run this command again to check if <em>virtualenv<\/em>\u00a0was installed properly:<\/p>\n<pre><strong>virtualenv --version<\/strong>\n16.0.0<\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67800\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd.png?resize=979%2C448&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"979\" height=\"448\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd.png?w=979&amp;quality=100&amp;strip=all&amp;ssl=1 979w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd.png?resize=300%2C137&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/cmd.png?resize=768%2C351&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 979px) 100vw, 979px\" \/><\/p>\n<h2>2b. Installing Python 2.7.X on Mac OS X<\/h2>\n<p>In order to use PlatformIO IDE and program your ESP32 boards, you must have Python 2.7.X installed in your computer.\u00a0Run the next sequence of commands to install Python 2.7.X. Then, check if Python, pip, and virtualenv are installed:<\/p>\n<pre>$ <strong>brew install python2<\/strong>\n\n$ <strong>python --version<\/strong>\nPython 2.7.15\n\n$ <strong>pip --version<\/strong>\npip 9.0.3\n\n$ <strong>virtualenv --version<\/strong>\n\n$ <strong>pip install virtualenv<\/strong><\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67802\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/isntall_python2_Mac.jpg?resize=722%2C273&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"722\" height=\"273\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/isntall_python2_Mac.jpg?w=722&amp;quality=100&amp;strip=all&amp;ssl=1 722w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/isntall_python2_Mac.jpg?resize=300%2C113&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 722px) 100vw, 722px\" \/><\/p>\n<h2>3. Installing Clang for Code Completion<\/h2>\n<p>PlatformIO IDE uses Clang for the Intelligent Code Completion. To check if Clang is available in your system, open Terminal\/Command Prompt and run:<\/p>\n<pre><strong>clang --version<\/strong><\/pre>\n<p>If clang is not installed, then install it by following the instructions for your Operating System:<\/p>\n<ul>\n<li><strong>Windows:<\/strong> download\u00a0<a href=\"http:\/\/llvm.org\/releases\/download.html\">Clang\u00a03.9.1 for Windows<\/a>. Select \u201c<strong>Add LLVM to the system PATH<\/strong>\u201d option during the installation step shown in the image below.\n<ul>\n<li><a class=\"reference external\" href=\"http:\/\/releases.llvm.org\/3.9.1\/LLVM-3.9.1-win32.exe\"><span class=\"highlighted\">Clang<\/span>\u00a03.9.1 for Windows (32-bit)<\/a><\/li>\n<li><a class=\"reference external\" href=\"http:\/\/releases.llvm.org\/3.9.1\/LLVM-3.9.1-win64.exe\"><span class=\"highlighted\">Clang<\/span>\u00a03.9.1 for Windows (64-bit)<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67799\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/clang-installer-add-path.png?resize=521%2C407&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"521\" height=\"407\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/clang-installer-add-path.png?w=521&amp;quality=100&amp;strip=all&amp;ssl=1 521w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/clang-installer-add-path.png?resize=300%2C234&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 521px) 100vw, 521px\" \/><\/p>\n<p><span style=\"color: #ff0000;\"><strong>Warning:\u00a0<\/strong>DO NOT INSTALL\u00a0<span class=\"highlighted\">CLANG<\/span>\u00a04.0, ONLY CLANG 3.9 IS SUPPORTED AT THE MOMENT.<\/span><\/p>\n<ul>\n<li><strong>Mac OS X:\u00a0<\/strong><a href=\"https:\/\/developer.apple.com\/xcode\/download\/\">install the latest Xcode<\/a>\u00a0along with the latest Command Line Tools. They are installed automatically when you run\u00a0<em>clang\u00a0<\/em>in Terminal for the first time, or manually by running:<\/li>\n<\/ul>\n<pre>xcode-select\u00a0--install<\/pre>\n<ul>\n<li><strong>Linux:<\/strong> using package managers:\u00a0<em>apt-get\u00a0install\u00a0clang\u00a0<\/em>or<em>\u00a0yum\u00a0install\u00a0clang<\/em>.<\/li>\n<li><strong>Other systems:<\/strong>\u00a0download the latest\u00a0<a href=\"http:\/\/llvm.org\/releases\/download.html\">Clang\u00a0for the other systems<\/a>.<\/li>\n<\/ul>\n<h2>4. Installing PlatformIO IDE on Atom<\/h2>\n<p>After installing all the PlatformIO IDE dependencies, open Atom text editor and go to <strong>File<\/strong> &gt; <strong>Settings<\/strong>:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67797\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-file-settings.png?resize=240%2C341&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"240\" height=\"341\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-file-settings.png?w=240&amp;quality=100&amp;strip=all&amp;ssl=1 240w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-file-settings.png?resize=211%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 211w\" sizes=\"(max-width: 240px) 100vw, 240px\" \/><\/p>\n<p>On the left menu, open the &#8220;<strong>Install<\/strong>&#8221; tab:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67798\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-settings-install.png?resize=1122%2C672&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1122\" height=\"672\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-settings-install.png?w=1122&amp;quality=100&amp;strip=all&amp;ssl=1 1122w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-settings-install.png?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-settings-install.png?resize=768%2C460&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom-settings-install.png?resize=1024%2C613&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1122px) 100vw, 1122px\" \/><\/p>\n<p>Search for &#8220;<strong>platformio<\/strong>&#8221; and press the Enter\/Return key:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67811\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom2-1024x674.png?resize=1024%2C674&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1024\" height=\"674\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom2-1024x674.png?resize=1024%2C674&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom2-1024x674.png?resize=300%2C197&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/atom2-1024x674.png?resize=768%2C506&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>Install the &#8220;<strong>platformio-ide<\/strong>&#8221; option highlighted in the preceding image. After the installation is completed, restart the Atom text editor for the changes to take effect.<\/p>\n<h2>5. PlatformIO IDE Overview<\/h2>\n<p>Now, when you open Atom text editor a new window should load with the &#8220;Welcome to PlatformIO&#8221; screen:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67807\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_main.png?resize=1066%2C694&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1066\" height=\"694\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_main.png?w=1066&amp;quality=100&amp;strip=all&amp;ssl=1 1066w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_main.png?resize=300%2C195&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_main.png?resize=768%2C500&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_main.png?resize=1024%2C667&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1066px) 100vw, 1066px\" \/><\/p>\n<p>Press the &#8220;<strong>New Project<\/strong>&#8221; button in the quick access menu:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67794\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/quick_access_platformio.png?resize=260%2C237&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"260\" height=\"237\" \/><\/p>\n<p>A new window loads that allows you to create a new project for your board, follow these next steps:<\/p>\n<ul>\n<li>Name your project (example: Blink);<\/li>\n<li>Search for &#8220;<strong>ESP32<\/strong>&#8221; and select your ESP32 board (example: DOIT ESP32 DEVKIT V1);<\/li>\n<li>Select <strong>Arduino<\/strong> framework;<\/li>\n<li>Press the &#8220;<strong>Finish<\/strong>&#8221; button.<\/li>\n<\/ul>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67804\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_esp32.png?resize=599%2C464&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"599\" height=\"464\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_esp32.png?w=599&amp;quality=100&amp;strip=all&amp;ssl=1 599w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_esp32.png?resize=300%2C232&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/p>\n<p>After the new project is created, you&#8217;ll see the project folder on the left menu that you can use to navigate through files and folders.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67803\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_blink.png?resize=851%2C370&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"851\" height=\"370\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_blink.png?w=851&amp;quality=100&amp;strip=all&amp;ssl=1 851w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_blink.png?resize=300%2C130&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_blink.png?resize=768%2C334&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 851px) 100vw, 851px\" \/><\/p>\n<p>Open the <strong><em>src<\/em> <\/strong>folder and double-click the <strong><em>main.cpp<\/em><\/strong> file to open it. A new window opens in Atom with that file, so you can edit it:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67805\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_open_file.png?resize=880%2C386&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"880\" height=\"386\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_open_file.png?w=880&amp;quality=100&amp;strip=all&amp;ssl=1 880w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_open_file.png?resize=300%2C132&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/new_project_open_file.png?resize=768%2C337&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/p>\n<p>The <em><strong>main.cpp<\/strong><\/em> file is like your <em><strong>Blink.ino<\/strong><\/em> file used in the Arduino IDE. You can write your Arduino code, but you need to start with the file by including the Arduino framework. So, basically all the Arduino sketches work with PlatformIO IDE, if you start the sketch with this line following line:<\/p>\n<pre><strong>#include &lt;Arduino.h&gt;\n<\/strong><\/pre>\n<h2>6. Testing\u00a0PlataformIO IDE<\/h2>\n<p>Let&#8217;s try an example to test PlataformIO IDE. We&#8217;ll blink an LED connected to GPIO23. Here&#8217;s the list of parts you need to follow this example:<\/p>\n<ul>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noopener noreferrer\">ESP32 development board<\/a>\u00a0\u2013\u00a0\u00a0<a href=\"https:\/\/makeradvisor.com\/esp32-development-boards-review-comparison\/\" target=\"_blank\" rel=\"noopener noreferrer\">read ESP32 Development Boards Review and Comparison<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\" rel=\"noopener noreferrer\">5mm LED<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\" rel=\"noopener noreferrer\">330 Ohm resistor<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\" rel=\"noopener noreferrer\">Breadboard<\/a><\/li>\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jumper wires<\/a><\/li>\n<\/ul>\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n<p>Follow the next schematic to assemble your circuit.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67795\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/schematic_bb.png?resize=727%2C673&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"727\" height=\"673\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/schematic_bb.png?w=727&amp;quality=100&amp;strip=all&amp;ssl=1 727w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/schematic_bb.png?resize=300%2C278&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/p>\n<p>Here&#8217;s a sketch for testing purposes that blinks the LED:<\/p>\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">#include &lt;Arduino.h&gt;\n\n\/\/ ledPin refers to ESP32 GPIO 23\nconst int ledPin = 23;\n\n\/\/ the setup function runs once when you press reset or power the board\nvoid setup() {\n    \/\/ initialize digital pin ledPin as an output.\n    pinMode(ledPin, OUTPUT);\n}\n\n\/\/ the loop function runs over and over again forever\nvoid loop() {\n    digitalWrite(ledPin, HIGH);   \/\/ turn the LED on (HIGH is the voltage level)\n    delay(1000);                  \/\/ wait for a second\n    digitalWrite(ledPin, LOW);    \/\/ turn the LED off by making the voltage LOW\n    delay(1000);                  \/\/ wait for a second\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-Course\/raw\/master\/code\/Blink_LED_PlatformIO\/Blink_LED_PlatformIO.ino\" target=\"_blank\">View raw code<\/a><\/p>\n<p>Copy the code to the Atom text editor and follow these next steps to upload code to your ESP32 board:<\/p>\n<ol>\n<li>Connect your ESP32 board to your computer;<\/li>\n<li>Save thew newly created sketch (<strong>File<\/strong> &gt; <strong>Save<\/strong>);<\/li>\n<li>Press the &#8220;<strong>Upload<\/strong>&#8221; button (highlighted in the next image).<\/li>\n<\/ol>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67813\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/upload_new_sketch.png?resize=832%2C134&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"832\" height=\"134\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/upload_new_sketch.png?w=832&amp;quality=100&amp;strip=all&amp;ssl=1 832w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/upload_new_sketch.png?resize=300%2C48&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/upload_new_sketch.png?resize=768%2C124&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 832px) 100vw, 832px\" \/><\/p>\n<p>Wait a few seconds while the sketch uploads to your board:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67788\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_upload_window.png?resize=486%2C233&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"486\" height=\"233\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_upload_window.png?w=486&amp;quality=100&amp;strip=all&amp;ssl=1 486w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio_upload_window.png?resize=300%2C144&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/p>\n<p>After uploading the sketch, your ESP32 should be blinking the LED attached to GPIO 23 every 1 second.<\/p>\n<p>That&#8217;s it! The PlatformIO was successfully installed and you can use it to program your ESP32 board.<\/p>\n<h2>7. PlatformIO IDE Additional Tips<\/h2>\n<p>We&#8217;ve just scratched the surface on what PlatformIO IDE can do. Here&#8217;s what each button in the PlatformIO IDE does\/means:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67806\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/Platformio-labeled.png?resize=803%2C98&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"803\" height=\"98\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/Platformio-labeled.png?w=803&amp;quality=100&amp;strip=all&amp;ssl=1 803w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/Platformio-labeled.png?resize=300%2C37&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/Platformio-labeled.png?resize=768%2C94&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 803px) 100vw, 803px\" \/><\/p>\n<ol>\n<li>PlatformIO Home<\/li>\n<li>PlatformIO Build<\/li>\n<li><strong>PlatformIO Upload<\/strong><\/li>\n<li>Upload to remote device<\/li>\n<li>PlatformIO Clean<\/li>\n<li>PlatformIO Test<\/li>\n<li>PlatformIO Debug<\/li>\n<li>Run other target<\/li>\n<li>Toggle Build Panel<\/li>\n<li>Find in Project<\/li>\n<li>Terminal<\/li>\n<li><strong>Serial Monitor (it&#8217;s like the Arduino IDE Serial Monitor)<\/strong><\/li>\n<li>Atom Settings<\/li>\n<\/ol>\n<p>We&#8217;ve modified the Blink code used previously to include some <em>Serial.println()<\/em>\u00a0commands to demonstrate how the Serial Monitor looks like. You can open the Serial Monitor by clicking that icon:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67790\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-open-serial-monitor.png?resize=957%2C634&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"957\" height=\"634\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-open-serial-monitor.png?w=957&amp;quality=100&amp;strip=all&amp;ssl=1 957w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-open-serial-monitor.png?resize=300%2C199&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-open-serial-monitor.png?resize=768%2C509&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 957px) 100vw, 957px\" \/><\/p>\n<p>The PlatformIO software should automatically complete your settings. Otherwise, select your ESP32 COM port and its baudrate. Then, press the &#8220;<strong>Start<\/strong>&#8221; button:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67792\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor-settings.png?resize=598%2C198&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"598\" height=\"198\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor-settings.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor-settings.png?resize=300%2C99&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/p>\n<p>Just like the Arduino IDE Serial Monitor, you have a window that outputs all the<em> Serial.println()<\/em> commands used in your code:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-67791\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor.png?resize=1034%2C326&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" width=\"1034\" height=\"326\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor.png?w=1034&amp;quality=100&amp;strip=all&amp;ssl=1 1034w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor.png?resize=300%2C95&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor.png?resize=768%2C242&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/platformio-serial-monitor.png?resize=1024%2C323&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1034px) 100vw, 1034px\" \/><\/p>\n<p>As you can see, it&#8217;s printing the messages: &#8220;LED on&#8221; and &#8220;LED off&#8221;.<\/p>\n<h2>Wrapping Up<\/h2>\n<p>We recommend using the following links as a resource to explore the additional functionalities and features that PlaformIO offers:<\/p>\n<ul>\n<li><a href=\"https:\/\/platformio.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE official website<\/a><\/li>\n<li><a href=\"http:\/\/docs.platformio.org\/en\/latest\/userguide\/\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE user guide<\/a><\/li>\n<li><a href=\"http:\/\/docs.platformio.org\/en\/latest\/\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE documentation<\/a><\/li>\n<li><a href=\"http:\/\/docs.platformio.org\/en\/latest\/platforms\/espressif32.html#boards\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE Espressif 32 (ESP32) boards<\/a><\/li>\n<\/ul>\n<p>We have other tutorials with ESP32 that you might like:<\/p>\n<ul>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-web-server-arduino-ide\/\">ESP32 Web Server \u2013 Arduino IDE<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/build-an-all-in-one-esp32-weather-station-shield\/\">Build an All-in-One ESP32 Weather Station<\/a><\/li>\n<li><a href=\"https:\/\/randomnerdtutorials.com\/alexa-echo-with-esp32-and-esp8266\/\">Alexa (Echo) with ESP32 &#8211; Voice Controlled Relay<\/a><\/li>\n<\/ul>\n<p>We hope you\u2019ve found this tutorial useful.\u00a0If you like ESP32 and you want to learn more, we recommend enrolling in\u00a0<a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\"><strong>Learn ESP32 with Arduino IDE<\/strong>\u00a0course<\/a>.<\/p>\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our ESP32 projects and tutorials, we recommend using the Arduino IDE to program the ESP32 development board. However, in some Windows computers it&#8217;s a bit tricky to install the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Programming ESP32 with Atom Text Editor and PlatformIO IDE\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/programming-esp32-with-atom-text-editor-and-platformio-ide\/#more-67787\" aria-label=\"Read more about Programming ESP32 with Atom Text Editor and PlatformIO IDE\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":67882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[276,281,277,299,269,264],"tags":[],"class_list":["post-67787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-esp32-arduino-ide","category-0-esp32","category-guide-project","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/07\/PlatformIO_atom_-thumbnail.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/67787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=67787"}],"version-history":[{"count":0,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/67787\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/67882"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=67787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=67787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=67787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}