{"id":99203,"date":"2020-09-24T14:24:12","date_gmt":"2020-09-24T14:24:12","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=99203"},"modified":"2024-02-28T11:07:37","modified_gmt":"2024-02-28T11:07:37","slug":"vs-code-platformio-ide-esp32-esp8266-arduino","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/vs-code-platformio-ide-esp32-esp8266-arduino\/","title":{"rendered":"Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)"},"content":{"rendered":"\n<p>Learn how to program the ESP32 and ESP8266 NodeMCU boards using VS Code (Microsoft Visual Studio Code) with PlatformIO IDE extension. We cover how to install the software on Windows, Mac OS X or Ubuntu operating systems.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Getting Started with VS Code and PlatformIO IDE for ESP32 and NodeMCU ESP8266 boards: Windows, Mac OS X, Linux Ubuntu\" class=\"wp-image-99353\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p>The Arduino IDE works great for small applications. However, for advanced projects with more than 200 lines of code, multiple files, and other advanced features like auto completion and error checking, VS Code with the PlatformIO IDE extension is the best alternative.<\/p>\n\n\n\n<p>In this tutorial, we&#8217;ll cover the following topics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installing VS Code (Visual Studio Code):\n<ul class=\"wp-block-list\">\n<li><a href=\"#1a\">A) Windows<\/a><\/li>\n\n\n\n<li><a href=\"#1b\">B) Mac OS X<\/a><\/li>\n\n\n\n<li><a href=\"#1c\">C) Linux Ubuntu<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#2\">Installing PlatformIO IDE Extension on VS Code<\/a><\/li>\n\n\n\n<li><a href=\"#3\">Visual Studio Quick Interface Overview<\/a><\/li>\n\n\n\n<li><a href=\"#4\">PlatformIO IDE Overview<\/a><\/li>\n\n\n\n<li><a href=\"#5\">Uploading Code using PlatformIO IDE: ESP32\/ESP8266<\/a><\/li>\n\n\n\n<li><a href=\"#6\">Changing the Serial Monitor Baud Rate &#8211; PlatformIO IDE<\/a><\/li>\n\n\n\n<li><a href=\"#7\">Installing Libraries on PlatformIO IDE<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1a\">A) Installing VS Code on Windows (Visual Studio Code)<\/h2>\n\n\n\n<p>Go to <a href=\"https:\/\/code.visualstudio.com\/\">https:\/\/code.visualstudio.com\/<\/a> and download the stable build for your operating system (Windows).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1012\" height=\"682\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Download-VS-Studio-Code.jpg?resize=1012%2C682&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Download Page for Windows PC\" class=\"wp-image-99205\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Download-VS-Studio-Code.jpg?w=1012&amp;quality=100&amp;strip=all&amp;ssl=1 1012w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Download-VS-Studio-Code.jpg?resize=300%2C202&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Download-VS-Studio-Code.jpg?resize=768%2C518&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1012px) 100vw, 1012px\" \/><\/figure><\/div>\n\n\n<p>Click on the installation wizard to start the installation and follow all the steps to complete the installation. Accept the agreement and press the <strong>Next <\/strong>button.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"598\" height=\"464\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Install-VS-Code.png?resize=598%2C464&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard\" class=\"wp-image-99206\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Install-VS-Code.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Install-VS-Code.png?resize=300%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure><\/div>\n\n\n<p>Select the following options and click <strong>Next<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"464\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Install-VS-Code.png?resize=598%2C464&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard step 2\" class=\"wp-image-99207\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Install-VS-Code.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Install-VS-Code.png?resize=300%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure><\/div>\n\n\n<p>Press the <strong>Install <\/strong>button.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"464\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Install-VS-Code.png?resize=598%2C464&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard step 3\" class=\"wp-image-99208\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Install-VS-Code.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Install-VS-Code.png?resize=300%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure><\/div>\n\n\n<p>Finally, click <strong>Finish <\/strong>to finish the installation.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"464\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Install-VS-Code.png?resize=598%2C464&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard final step\" class=\"wp-image-99204\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Install-VS-Code.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Install-VS-Code.png?resize=300%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure><\/div>\n\n\n<p>Open VS Code and you\u2019ll be greeted by a Welcome tab with the released notes of the newest version.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1033\" height=\"770\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Welcome-Screen.png?resize=1033%2C770&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard welcome screen on a Windows PC\" class=\"wp-image-99216\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Welcome-Screen.png?w=1033&amp;quality=100&amp;strip=all&amp;ssl=1 1033w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Welcome-Screen.png?resize=300%2C224&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Welcome-Screen.png?resize=1024%2C763&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Welcome-Screen.png?resize=768%2C572&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1033px) 100vw, 1033px\" \/><\/figure><\/div>\n\n\n<p>That\u2019s it. Visual Studio Code was successfully installed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Python on Windows<\/h3>\n\n\n\n<p>To program the ESP32 and ESP8266 boards with PlatformIO IDE you need Python 3.5 or higher installed in your computer. We\u2019re using Python 3.8.5.<\/p>\n\n\n\n<p>Go to <a href=\"http:\/\/python.org\/download\" target=\"_blank\" rel=\"noreferrer noopener\">python.org\/download<\/a> and download Python 3.8.5 or a newest version.<\/p>\n\n\n\n<p>Open the downloaded file to start the Python installation wizard.<\/p>\n\n\n\n<p>The following window shows up.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"410\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Python-Add-to-path.png?resize=666%2C410&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing Python 3.8.5 on a Windows PC and Add to Path\" class=\"wp-image-99217\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Python-Add-to-path.png?w=666&amp;quality=100&amp;strip=all&amp;ssl=1 666w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Python-Add-to-path.png?resize=300%2C185&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntcred\"><strong>IMPORTANT: Make sure you check the option Add Python 3.8 to PATH. <\/strong>Then, you can click on the <strong>Install Now<\/strong> button.<\/p>\n\n\n\n<p>When the installation is successful you\u2019ll get the following message.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"410\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Python-Installation-successful.png?resize=666%2C410&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Python Installation successful on Windows PC\" class=\"wp-image-99218\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Python-Installation-successful.png?w=666&amp;quality=100&amp;strip=all&amp;ssl=1 666w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Python-Installation-successful.png?resize=300%2C185&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/figure><\/div>\n\n\n<p>You can click the <strong>Close<\/strong> button.<\/p>\n\n\n\n<p>Now, <a href=\"#2\">go to this section to install PlatformIO IDE extension<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1b\">B) Installing VS Code on Mac OS X (Visual Studio Code)<\/h2>\n\n\n\n<p>Go to <a href=\"https:\/\/code.visualstudio.com\/\">https:\/\/code.visualstudio.com\/<\/a> and download the stable build for your operating system (Mac OS X).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1167\" height=\"592\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-download-Mac-OS-X.png?resize=1167%2C592&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Download Page for Mac OS X\" class=\"wp-image-99336\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-download-Mac-OS-X.png?w=1167&amp;quality=100&amp;strip=all&amp;ssl=1 1167w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-download-Mac-OS-X.png?resize=300%2C152&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-download-Mac-OS-X.png?resize=1024%2C519&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-download-Mac-OS-X.png?resize=768%2C390&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1167px) 100vw, 1167px\" \/><\/figure><\/div>\n\n\n<p>After downloading the Visual Studio Code application file, you&#8217;ll be prompted with the following message. Press the &#8220;<strong>Open<\/strong>&#8221; button.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"158\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-save-file.png?resize=487%2C158&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Downloading application file for Mac OS X\" class=\"wp-image-99338\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-save-file.png?w=487&amp;quality=100&amp;strip=all&amp;ssl=1 487w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-save-file.png?resize=300%2C97&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><\/figure><\/div>\n\n\n<p>Or open your Downloads folder and open Visual Studio Code.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"214\" height=\"140\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-file-downloaded-Mac-OS-X.png?resize=214%2C140&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Downloading application file for Mac OS X\" class=\"wp-image-99337\"\/><\/figure><\/div>\n\n\n<p>After that, you\u2019ll be greeted by a Welcome tab with the released notes of the newest version.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"767\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-installed.png?resize=1024%2C767&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard welcome screen on Max OS X\" class=\"wp-image-99339\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-installed.png?w=1024&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-installed.png?resize=300%2C225&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-installed.png?resize=768%2C575&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>That\u2019s it. Visual Studio Code was successfully installed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Python on Mac OS X<\/h3>\n\n\n\n<p>To program the ESP32 and ESP8266 boards with PlatformIO IDE you need Python 3.5 or higher installed in your computer. We\u2019re using Python 3.8.5.<\/p>\n\n\n\n<p>To install Python I&#8217;ll be using Homebrew. If you don&#8217;t have the brew command available, type the next command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install.sh)\"\n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"860\" height=\"110\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-brew.png?resize=860%2C110&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code installing homebrew\" class=\"wp-image-99334\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-brew.png?w=860&amp;quality=100&amp;strip=all&amp;ssl=1 860w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-brew.png?resize=300%2C38&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-brew.png?resize=768%2C98&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/figure><\/div>\n\n\n<p>Then, run the  brew command to install Python 3.X:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ brew install python3<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"632\" height=\"210\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-Python3.png?resize=632%2C210&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code installing Python 3 with brew command\" class=\"wp-image-99335\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-Python3.png?w=632&amp;quality=100&amp;strip=all&amp;ssl=1 632w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-install-Python3.png?resize=300%2C100&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 632px) 100vw, 632px\" \/><\/figure><\/div>\n\n\n<p>Now, <a href=\"#2\">go to this section to install PlatformIO IDE extension<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1c\">C) Installing VS Code on Linux Ubuntu (Visual Studio Code)<\/h2>\n\n\n\n<p>Go to <a href=\"https:\/\/code.visualstudio.com\/\">https:\/\/code.visualstudio.com\/<\/a> and download the stable build for your operating system (Linux Ubuntu).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"438\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?resize=961%2C438&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Download Page for Linux Ubuntu\" class=\"wp-image-99324\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?w=961&amp;quality=100&amp;strip=all&amp;ssl=1 961w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?resize=300%2C137&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/3-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?resize=768%2C350&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 961px) 100vw, 961px\" \/><\/figure><\/div>\n\n\n<p>Save the installation file:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"495\" height=\"350\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?resize=495%2C350&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Save installation file for Linux Ubuntu\" class=\"wp-image-99325\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?w=495&amp;quality=100&amp;strip=all&amp;ssl=1 495w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/4-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu.png?resize=300%2C212&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/figure><\/div>\n\n\n<p>To install it, open a Terminal windows, navigate to your Downloads folder and run the following command to install VS Code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cd Downloads\n~\/Downloads $ sudo apt install .\/code_1.49.1-1600299189_amd64.deb<\/code><\/pre>\n\n\n\n<p>When the installation is finished, VS Code should be available in your applications menu.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"516\" height=\"326\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-run-VS-Code-Linux-Ubuntu.png?resize=516%2C326&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Open application Linux Ubuntu\" class=\"wp-image-99326\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-run-VS-Code-Linux-Ubuntu.png?w=516&amp;quality=100&amp;strip=all&amp;ssl=1 516w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/5-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-run-VS-Code-Linux-Ubuntu.png?resize=300%2C190&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 516px) 100vw, 516px\" \/><\/figure><\/div>\n\n\n<p>Open VS Code and you\u2019ll be greeted by a Welcome tab with the released notes of the newest version.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"632\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu-Testing.png?resize=1024%2C632&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Microsoft Visual Studio Code VS Code Installation wizard welcome screen on Linux Ubuntu\" class=\"wp-image-99327\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu-Testing.png?w=1024&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu-Testing.png?resize=300%2C185&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/6-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-downloading-VS-Code-Linux-Ubuntu-Testing.png?resize=768%2C474&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>That\u2019s it. Visual Studio Code was successfully installed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Python on Linux Ubuntu<\/h3>\n\n\n\n<p>To program the ESP32 and ESP8266 boards with PlatformIO IDE you need Python 3.5 or higher installed in your computer. We\u2019re using Python 3.8.<\/p>\n\n\n\n<p>Open the Terminal window and check that you already have Python 3 installed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ python3 --version\npython 3.8.2\n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"389\" height=\"144\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed.png?resize=389%2C144&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Linux ubuntu installing Python3 testing version\" class=\"wp-image-99322\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed.png?w=389&amp;quality=100&amp;strip=all&amp;ssl=1 389w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/1-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed.png?resize=300%2C111&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 389px) 100vw, 389px\" \/><\/figure><\/div>\n\n\n<p>As you can see in the preceding figure, Python 3.8.2 is already installed. <\/p>\n\n\n\n<p>If you don&#8217;t have Python 3.8.X installed, run the next command to install it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install python3<\/code><\/pre>\n\n\n\n<p>Whether you already have Python installed or not, you need to run the following command to install Python utilities.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt install python3-distutils<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"452\" height=\"91\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed-distutils.png?resize=452%2C91&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Installing python3-distutils Linux Ubuntu for PlatformIO IDE\" class=\"wp-image-99323\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed-distutils.png?w=452&amp;quality=100&amp;strip=all&amp;ssl=1 452w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/2-Getting-Started-VS-Code-PlatformIO-IDE-ESP32-ESP8266-Python3-installed-distutils.png?resize=300%2C60&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/figure><\/div>\n\n\n<p>Now, <a href=\"#2\">go to this section to install PlatformIO IDE extension<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2\">Installing PlatformIO IDE Extension on VS Code<\/h2>\n\n\n\n<p>It is possible to program the <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">ESP32<\/a> and <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp8266\/\">ESP8266<\/a> boards using VS Code with the PlatformIO IDE extension. Follow the next steps to install the PlatformIO IDE extension.<\/p>\n\n\n\n<p>Open VS Code:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on the <strong>Extensions <\/strong>icon or press <strong>Ctrl<\/strong>+<strong>Shift<\/strong>+<strong>X<\/strong> to open the <strong>Extensions <\/strong>tab<\/li>\n\n\n\n<li>Search for \u201c<strong>PlatformIO IDE<\/strong>\u201d<\/li>\n\n\n\n<li>Select the first option <\/li>\n\n\n\n<li>Finally, click the <strong>Install<\/strong> button (Note: the installation may take a few minutes)<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"495\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Platformio-Extension-VS-Code.png?resize=897%2C495&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Install PlatformIO IDE Extension on VS Code\" class=\"wp-image-99219\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Platformio-Extension-VS-Code.png?w=897&amp;quality=100&amp;strip=all&amp;ssl=1 897w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Platformio-Extension-VS-Code.png?resize=300%2C166&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Install-Platformio-Extension-VS-Code.png?resize=768%2C424&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 897px) 100vw, 897px\" \/><\/figure><\/div>\n\n\n<p>After installing, make sure that PlatformIO IDE extension is enabled as shown below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"947\" height=\"282\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformioextension-enabled.png?resize=947%2C282&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE Extension Enabled on VS Code\" class=\"wp-image-99220\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformioextension-enabled.png?w=947&amp;quality=100&amp;strip=all&amp;ssl=1 947w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformioextension-enabled.png?resize=300%2C89&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformioextension-enabled.png?resize=768%2C229&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 947px) 100vw, 947px\" \/><\/figure><\/div>\n\n\n<p>After that, the PlatformIO icon should show up on the left sidebar as well as an <strong>Home<\/strong> icon that redirects you to PlatformIO home.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1006\" height=\"648\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-extension-installed-successfully.png?resize=1006%2C648&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO Extension Installed Successfully\" class=\"wp-image-99221\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-extension-installed-successfully.png?w=1006&amp;quality=100&amp;strip=all&amp;ssl=1 1006w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-extension-installed-successfully.png?resize=300%2C193&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-extension-installed-successfully.png?resize=768%2C495&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/figure><\/div>\n\n\n<p>That\u2019s it, PlatformIO IDE extension was successfully added to VS Code.<\/p>\n\n\n\n<p>If you don\u2019t see the <strong>PIO <\/strong>icon and the quick tools at the bottom, you may need to restart VS code for the changes to take effect.<\/p>\n\n\n\n<p>Either way, we recommend restarting VS Code before proceeding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3\">VS Code Quick Interface Overview<\/h2>\n\n\n\n<p>Open VS Code. The following print screen shows the meaning of each icon on the left sidebar and its shortcuts:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"495\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Interface-Overview.png?resize=897%2C495&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"VS Code Visual Studio Application Interface Overview\" class=\"wp-image-99223\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Interface-Overview.png?w=897&amp;quality=100&amp;strip=all&amp;ssl=1 897w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Interface-Overview.png?resize=300%2C166&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Interface-Overview.png?resize=768%2C424&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 897px) 100vw, 897px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>File explorer<\/li>\n\n\n\n<li>Search across files<\/li>\n\n\n\n<li>Source code management (using gist)<\/li>\n\n\n\n<li>Launch and debug your code<\/li>\n\n\n\n<li>Manage extensions<\/li>\n<\/ul>\n\n\n\n<p>Additionally, you can press <strong>Ctrl<\/strong>+<strong>Shift<\/strong>+<strong>P<\/strong> or go to <strong>View <\/strong>&gt;<strong> Command Palette\u2026<\/strong> to show all the available commands. If you\u2019re searching for a command and you don\u2019t know where it is or its shortcut, you just need to go to the Command Palette and search for it.<\/p>\n\n\n\n<p>At the bottom, there\u2019s a blue bar with PlatformIO commands.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"183\" height=\"20\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Quick-Tools-Icons.png?resize=183%2C20&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension Quick Tools Icons\" class=\"wp-image-99224\"\/><\/figure><\/div>\n\n\n<p>Here\u2019s the what icon does from left to right:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PlatformIO Home<\/li>\n\n\n\n<li>Build\/Compile<\/li>\n\n\n\n<li>Upload<\/li>\n\n\n\n<li>Clean<\/li>\n\n\n\n<li>Serial Monitor<\/li>\n\n\n\n<li>New Terminal<\/li>\n<\/ul>\n\n\n\n<p>If you hover your mouse over the icons, it will show what each icon does.<\/p>\n\n\n\n<p>Alternatively, you can also click on the PIO icon to see all the PlatformIO tasks.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"937\" height=\"573\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Tasks.png?resize=937%2C573&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension Tasks menu\" class=\"wp-image-99225\" style=\"width:820px;height:501px\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Tasks.png?w=937&amp;quality=100&amp;strip=all&amp;ssl=1 937w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Tasks.png?resize=300%2C183&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Tasks.png?resize=768%2C470&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 937px) 100vw, 937px\" \/><\/figure><\/div>\n\n\n<p>If the tasks don\u2019t show up on your IDE when you click the icon, you may need to click on the three dot icon at the top and enable PlatformIO tasks as shown below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"936\" height=\"574\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Enable-PlatformIO-Tasks.png?resize=936%2C574&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Enable PlatformIO IDE extension tasks\" class=\"wp-image-99226\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Enable-PlatformIO-Tasks.png?w=936&amp;quality=100&amp;strip=all&amp;ssl=1 936w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Enable-PlatformIO-Tasks.png?resize=300%2C184&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Enable-PlatformIO-Tasks.png?resize=768%2C471&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"4\">PlatformIO IDE Overview<\/h2>\n\n\n\n<p>For you to get an overview on how PlatformIO works on VS code, we\u2019ll show you how to create, save and upload a \u201cBlinking LED\u201d sketch to your ESP32 or ESP8266 board.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create a New Project<\/h3>\n\n\n\n<p>On VS Code, click on the PlartfomIO <strong>Home <\/strong>icon. Click on <strong>+ New Project<\/strong> to start a new project.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1006\" height=\"432\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project.png?resize=1006%2C432&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Create New Project PlatformIO VS Code\" class=\"wp-image-99227\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project.png?w=1006&amp;quality=100&amp;strip=all&amp;ssl=1 1006w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project.png?resize=300%2C129&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project.png?resize=768%2C330&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/figure><\/div>\n\n\n<p>Give your project a name (for example <em>Blink_LED<\/em>) and select the board you\u2019re using. In our case, we\u2019re using the <strong><a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noreferrer noopener\">DOIT ESP32 DEVKIT V1<\/a><\/strong>. The Framework should be \u201c<strong>Arduino<\/strong>\u201d to use the Arduino core. <\/p>\n\n\n\n<p>You can choose the default location to save your project or a custom location.<\/p>\n\n\n\n<p>The default location is in this path <em>Documents <\/em>&gt;<em>PlatformIO<\/em> &gt;<em>Projects<\/em>. For this test, you can use the default location. Finally, click \u201cFinish\u201d.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"470\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP32.png?resize=598%2C470&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO with VS Code Create New ESP32 Project\" class=\"wp-image-99228\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP32.png?w=598&amp;quality=100&amp;strip=all&amp;ssl=1 598w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP32.png?resize=300%2C236&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/figure><\/div>\n\n\n<p>For this example, we\u2019ll be using the <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noreferrer noopener\">DOIT ESP32 DEVKIT board<\/a>. If you are using an <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP8266 NodeMCU board<\/a> the process is very similar, you just need to select your ESP8266 board:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"472\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP8266.png?resize=602%2C472&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension with VS Code Create New ESP8266 Project\" class=\"wp-image-99229\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP8266.png?w=602&amp;quality=100&amp;strip=all&amp;ssl=1 602w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Create-New-Project-ESP8266.png?resize=300%2C235&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure><\/div>\n\n\n<p>The Blink_LED project should be accessible from the Explorer tab.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1006\" height=\"411\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatfomIO-project-created-folder-structure.png?resize=1006%2C411&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE Extension Project Folder Structure\" class=\"wp-image-99230\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatfomIO-project-created-folder-structure.png?w=1006&amp;quality=100&amp;strip=all&amp;ssl=1 1006w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatfomIO-project-created-folder-structure.png?resize=300%2C123&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatfomIO-project-created-folder-structure.png?resize=768%2C314&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/figure><\/div>\n\n\n<p>VS Code and PlatformIO have a folder structure that is different from the standard <em>.ino<\/em> project. If you click on the Explorer tab, you\u2019ll see all the files it created under your project folder. It may seem a lot of files to work with. But, don\u2019t worry, usually you\u2019ll just need to deal with one or two of those files.<\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Warning: <\/strong> you shouldn\u2019t delete, modify or move the folders and the <em>platformio.ini<\/em> file. Otherwise, you will no longer be able to compile your project using PlatformIO.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">platformio.ini file<\/h3>\n\n\n\n<p>The <em>platformio.ini<\/em> file is the PlatformIO Configuration File for your project. It shows the platform, board, and framework for your project. You can also add other configurations like libraries to be included, upload options, changing the Serial Monitor baud rate and other configurations.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"903\" height=\"364\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Config-init-file-ESP32.png?resize=903%2C364&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension Configuration File for ESP32\" class=\"wp-image-99231\" style=\"width:820px;height:330px\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Config-init-file-ESP32.png?w=903&amp;quality=100&amp;strip=all&amp;ssl=1 903w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Config-init-file-ESP32.png?resize=300%2C121&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Config-init-file-ESP32.png?resize=768%2C310&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>platform<\/strong>: which corresponds to the SoC used by the board.<\/li>\n\n\n\n<li><strong>board<\/strong>: the development board you\u2019re using.<\/li>\n\n\n\n<li><strong>framework<\/strong>: the software environment that will run the project code.<\/li>\n<\/ul>\n\n\n\n<p>With the ESP32 and ESP8266, if you want to use a baud rate of 115200 in your Serial Monitor, you just need to add the following line to your <em>platformio.ini<\/em> file.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>monitor_speed = 115200<\/code><\/pre>\n\n\n\n<p>After that, make sure you save the changes made to the file by pressing <strong>Ctrl<\/strong>+<strong>S<\/strong>.<\/p>\n\n\n\n<p>In this file, you can also include the identifier of libraries you\u2019ll use in your project using the <span class=\"rnthl rntliteral\">lib_deps<\/span> directive, as we&#8217;ll see later.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">src folder<\/h3>\n\n\n\n<p>The <em>src <\/em>folder is your working folder. Under the <em>src <\/em>folder, there\u2019s a<em> main.cpp<\/em> file. That\u2019s where you write your code. Click on that file. The structure of an Arduino program should open with the <span class=\"rnthl rntliteral\">setup()<\/span> and <span class=\"rnthl rntliteral\">loop()<\/span> functions.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1006\" height=\"347\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-scr-folder-main-file.png?resize=1006%2C347&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension main.cpp file under src folder\" class=\"wp-image-99232\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-scr-folder-main-file.png?w=1006&amp;quality=100&amp;strip=all&amp;ssl=1 1006w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-scr-folder-main-file.png?resize=300%2C103&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-scr-folder-main-file.png?resize=768%2C265&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/figure><\/div>\n\n\n<p>In PlatformIO, all your Arduino sketches should start with the <span class=\"rnthl rntliteral\">#include &lt;Arduino.h&gt;<\/span>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"5\">Uploading Code using PlatformIO IDE: ESP32\/ESP8266<\/h2>\n\n\n\n<p>Copy the following code to your <em>main.cpp<\/em> file.&nbsp;<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*********\n  Rui Santos\n  Complete project details at https:\/\/RandomNerdTutorials.com\/vs-code-platformio-ide-esp32-esp8266-arduino\/\n*********\/\n\n#include &lt;Arduino.h&gt;\n\n#define LED 2\n\nvoid setup() {\n  \/\/ put your setup code here, to run once:\n  Serial.begin(115200);\n  pinMode(LED, OUTPUT);\n}\n\nvoid loop() {\n  \/\/ put your main code here, to run repeatedly:\n  digitalWrite(LED, HIGH);\n  Serial.println(&quot;LED is on&quot;);\n  delay(1000);\n  digitalWrite(LED, LOW);\n  Serial.println(&quot;LED is off&quot;);\n  delay(1000);\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP\/ESP_Blink_VS_Code.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>This code blinks the on-board LED every second. It works with the ESP32 and ESP8266 boards (both have the on-board LED connected to GPIO 2).&nbsp;<\/p>\n\n\n\n<p>We recommend that you copy this code manually, so that you see the autocompletion and other interesting features of the IDE in action. Additionally, if you have a syntax error somewhere in your program, it will underline it in red even before compiling.<\/p>\n\n\n\n<p>After that, press <strong>Ctrl<\/strong>+<strong>S<\/strong> or go to <strong>File <\/strong>&gt; <strong>Save <\/strong>to save the file.<\/p>\n\n\n\n<p>Now, you can click on the Upload icon to compile and upload the code. Alternatively, you can go to the PIO Project Tasks menu and select <strong>Upload<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"415\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code.png?resize=906%2C415&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Upload Code ESP32 board PlatformIO VS Code Visual Studio\" class=\"wp-image-99233\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code.png?w=906&amp;quality=100&amp;strip=all&amp;ssl=1 906w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code.png?resize=300%2C137&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code.png?resize=768%2C352&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 906px) 100vw, 906px\" \/><\/figure><\/div>\n\n\n<p>If the code is successfully uploaded, you should get the following message.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"650\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code-Success.png?resize=905%2C650&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Upload Code to ESP32 PlatformIO VS Code Success\" class=\"wp-image-99235\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code-Success.png?w=905&amp;quality=100&amp;strip=all&amp;ssl=1 905w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code-Success.png?resize=300%2C215&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Upload-Code-ESP32-PlatformIO-VS-Code-Success.png?resize=768%2C552&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 905px) 100vw, 905px\" \/><\/figure><\/div>\n\n\n<p>After uploading the code, the ESP32 or ESP8266 should be blinking its on-board LED every second.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-board-Built_in-LED-turned-on-HIGH.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 board Built in LED turned on HIGH\" class=\"wp-image-96167\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-board-Built_in-LED-turned-on-HIGH.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/04\/ESP32-board-Built_in-LED-turned-on-HIGH.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>Now, click on the Serial Monitor icon and you should see it printing the current LED state.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"907\" height=\"469\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformio-VS-Code-Serial-Monitor-ESP32.png?resize=907%2C469&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE VS Code Visual Studio Serial Monitor ESP32 board\" class=\"wp-image-99236\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformio-VS-Code-Serial-Monitor-ESP32.png?w=907&amp;quality=100&amp;strip=all&amp;ssl=1 907w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformio-VS-Code-Serial-Monitor-ESP32.png?resize=300%2C155&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Platformio-VS-Code-Serial-Monitor-ESP32.png?resize=768%2C397&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 907px) 100vw, 907px\" \/><\/figure><\/div>\n\n\n<p><strong>Note: <\/strong> if you don\u2019t see the Terminal window, go to the menu Terminal &gt;  New Terminal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Detect COM Port<\/h3>\n\n\n\n<p>PlatformIO will automatically detect the port your board is connected to. To check the connected devices you can go to the <strong>PIO Home<\/strong> and click the <strong>Devices <\/strong>icon.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"661\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Devices-COM-port.png?resize=996%2C661&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension VS Code Visual Studio Connected Devices COM Port Serial\" class=\"wp-image-99237\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Devices-COM-port.png?w=996&amp;quality=100&amp;strip=all&amp;ssl=1 996w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Devices-COM-port.png?resize=300%2C199&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Devices-COM-port.png?resize=768%2C510&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Troubleshooting<\/h3>\n\n\n\n<p><strong>1)<\/strong>\u00a0If you try to upload a new sketch to your ESP32 and you get this error message \u201c<em>A fatal error occurred: Failed to connect to ESP32: Timed out\u2026 Connecting\u2026<\/em>\u201c. It means that your ESP32 is not in flashing\/uploading mode.<\/p>\n\n\n\n<p>Having the right board name and COM por selected, follow these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hold-down the <strong>BOOT<\/strong> button in your ESP32 board<\/li>\n\n\n\n<li>Press the <strong>Upload <\/strong>button in the Arduino IDE to upload your sketch<\/li>\n\n\n\n<li>After you see the&nbsp;&nbsp;&#8220;<em>Connecting\u2026.<\/em>&#8221; message in your Arduino IDE, release the finger from the <strong>BOOT&nbsp;<\/strong>button<\/li>\n\n\n\n<li>After that, you should see the &#8220;<em>Done uploading<\/em>&#8221; message<\/li>\n<\/ul>\n\n\n\n<p>You&#8217;ll also have to repeat that button sequence every time you want to upload a new sketch. But if you want to solve this issue once for all without the need to press the <strong>BOOT <\/strong>button, follow the suggestions in the next guide:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header\/\">[SOLVED] Failed to connect to ESP32: Timed out waiting for packet header<\/a><\/li>\n<\/ul>\n\n\n\n<p><strong>2)<\/strong> If you get the error &#8220;COM Port not found\/not available&#8221;, you might need to install the CP210x Drivers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/install-esp32-esp8266-usb-drivers-cp210x-windows\/\">Install USB Drivers \u2013 CP210x USB to UART Bridge (Windows PC)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/install-esp32-esp8266-usb-drivers-cp210x-mac-os\/\">Install USB Drivers \u2013 CP210x USB to UART Bridge (Mac OS X)<\/a><\/li>\n<\/ul>\n\n\n\n<p>If you experience any problems or issues with your ESP32, take a look at our in-depth <a href=\"https:\/\/randomnerdtutorials.com\/esp32-troubleshooting-guide\/\">ESP32 Troubleshooting Guide<\/a>. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6\">Changing the Serial Monitor Baud Rate &#8211; PlatformIO IDE<\/h2>\n\n\n\n<p>The default baud rate used by PlatformIO is 9600. However, it is possible to set up a different value as mentioned previously. On the File Explorer, under your project folder, open the <em>platformio.ini<\/em> file and add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>monitor_speed = baud_rate<\/code><\/pre>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>monitor_speed = 115200<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"916\" height=\"357\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-change-serial-monitor-baud-rate.png?resize=916%2C357&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extesion Change Serial Monitor Baud Rate 115200\" class=\"wp-image-99242\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-change-serial-monitor-baud-rate.png?w=916&amp;quality=100&amp;strip=all&amp;ssl=1 916w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-change-serial-monitor-baud-rate.png?resize=300%2C117&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-change-serial-monitor-baud-rate.png?resize=768%2C299&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 916px) 100vw, 916px\" \/><\/figure><\/div>\n\n\n<p>After that, save that file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"7\">Installing ESP32\/ESP8266 Libraries on PlatformIO IDE<\/h2>\n\n\n\n<p>Follow the next procedure if you need to install libraries in PlatformIO IDE.<\/p>\n\n\n\n<p>Click the <strong>Home <\/strong>icon to go to PlatformIO Home. Click on the <strong>Libraries <\/strong>icon on the left side bar.<\/p>\n\n\n\n<p>Search for the library you want to install. For example <em>Adafruit_BME280<\/em>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"661\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Search-BME280-library.png?resize=996%2C661&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE extension VS Code Visual Studio Search for BME280 Library\" class=\"wp-image-99243\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Search-BME280-library.png?w=996&amp;quality=100&amp;strip=all&amp;ssl=1 996w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Search-BME280-library.png?resize=300%2C199&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Search-BME280-library.png?resize=768%2C510&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/figure><\/div>\n\n\n<p>Click on the library you want to include in your project. Then, click <strong>Add to Project<\/strong>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"745\" height=\"243\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-add-library-to-project.png?resize=745%2C243&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO with VS Code Add Library to Project\" class=\"wp-image-99245\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-add-library-to-project.png?w=745&amp;quality=100&amp;strip=all&amp;ssl=1 745w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-add-library-to-project.png?resize=300%2C98&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 745px) 100vw, 745px\" \/><\/figure><\/div>\n\n\n<p>Select the project were you want to use the library.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"701\" height=\"419\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Add-Library-to-Project-Choose-Project.png?resize=701%2C419&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO with VS Code Add Library to Project Choose Project\" class=\"wp-image-99246\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Add-Library-to-Project-Choose-Project.png?w=701&amp;quality=100&amp;strip=all&amp;ssl=1 701w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-VS-Code-Add-Library-to-Project-Choose-Project.png?resize=300%2C179&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/figure><\/div>\n\n\n<p>This will add the library identifier using the <span class=\"rnthl rntliteral\">lib_deps<\/span> directive on the <em>platformio.ini<\/em> file. If you open your project&#8217;s <em>platformio.ini<\/em> file, it should look as shown in the following image.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PIO-Configuration-File-Add-Library.png?resize=905%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Add Library Identifier to Configuration File PlatformIO\" class=\"wp-image-99251\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PIO-Configuration-File-Add-Library.png?w=905&amp;quality=100&amp;strip=all&amp;ssl=1 905w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PIO-Configuration-File-Add-Library.png?resize=300%2C140&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PIO-Configuration-File-Add-Library.png?resize=768%2C357&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 905px) 100vw, 905px\" \/><\/figure><\/div>\n\n\n<p>Alternatively, on the library window, if you select the <strong>Installation <\/strong>tab and scroll a bit, you\u2019ll see the identifier for the library. You can choose any of those identifiers depending on the options you want to use. The library identifiers are highlighted in red.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"833\" height=\"650\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Library-registry.png?resize=833%2C650&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"PlatformIO IDE Extension Library Registry menu\" class=\"wp-image-99260\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Library-registry.png?w=833&amp;quality=100&amp;strip=all&amp;ssl=1 833w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Library-registry.png?resize=300%2C234&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-Library-registry.png?resize=768%2C599&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 833px) 100vw, 833px\" \/><\/figure><\/div>\n\n\n<p>Then, go to the <em>platformio.ini<\/em> file of your project and paste the library identifier into that file, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lib_deps = adafruit\/Adafruit BME280 Library@^2.1.0<\/code><\/pre>\n\n\n\n<p>If you need multiple libraries, you can separate their name by a coma or put them on different lines. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lib_deps =\n  arduino-libraries\/Arduino_JSON @ 0.1.0\n  adafruit\/Adafruit BME280 Library @ ^2.1.0\n  adafruit\/Adafruit Unified Sensor @ ^1.1.4<\/code><\/pre>\n\n\n\n<p>PlatformIO has a built-in powerful Library Manager, that allows you to specify custom dependencies per project in the Project Configuration File <em>platformio.ini<\/em> using <span class=\"rnthl rntliteral\"> lib_deps<\/span>. This will tell PlatformIO to automatically download the library and all its dependencies when you save the configuration file or when you compile your project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Open a Project Folder<\/h2>\n\n\n\n<p>To open an existing project folder on PlatformIO, open VS Code, go to PlatformIO Home and click on <strong>Open Project<\/strong>. Navigate through the files and select your project folder.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"444\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-open-project-folder.png?resize=878%2C444&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"VS Code with PlatformIO Open Project Folder\" class=\"wp-image-99363\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-open-project-folder.png?w=878&amp;quality=100&amp;strip=all&amp;ssl=1 878w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-open-project-folder.png?resize=300%2C152&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/PlatformIO-open-project-folder.png?resize=768%2C388&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 878px) 100vw, 878px\" \/><\/figure><\/div>\n\n\n<p>PlatformIO will open all the files within the project folder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8\">VS Code Color Themes<\/h2>\n\n\n\n<p>VS Code lets you choose between different color themes. Go to the <strong>Manage<\/strong> icon and select <strong>Color Theme<\/strong>. You can then select from several different light and dark themes.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"318\" height=\"429\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Change-Color-Theme.png?resize=318%2C429&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"VS Code Visual Studio Change Color Themes Dark Light\" class=\"wp-image-99262\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Change-Color-Theme.png?w=318&amp;quality=100&amp;strip=all&amp;ssl=1 318w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/VS-Code-Change-Color-Theme.png?resize=222%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 222w\" sizes=\"(max-width: 318px) 100vw, 318px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"9\">Shortcuts\u2019 List<\/h2>\n\n\n\n<p>For a complete list of VS Code shortcuts for Windows, Mac OS X or Linux, check the next link: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/code.visualstudio.com\/docs\/getstarted\/keybindings#_keyboard-shortcuts-reference\" target=\"_blank\" rel=\"noreferrer noopener\">VS Code Keyboard Shortcuts Reference<\/a>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you\u2019ve learned how to install and prepare Visual Studio Code to work with the ESP32 and ESP8266 boards. VS Code with the PlatformIO IDE extension is a great alternative to the classical Arduino IDE, especially when you\u2019re working on more advanced sketches for larger applications.<\/p>\n\n\n\n<p>Here\u2019s some of the advantages of using VS Code with PlatformIO IDE over Arduino IDE:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>It detects the COM port your board is connected to automatically;&nbsp;<\/li>\n\n\n\n<li>VS Code IntelliSense: Auto-Complete. IntelliSense code completion tries to guess what you want to write, displaying the different possibilities and provides insight into the parameters that a function may expect;<\/li>\n\n\n\n<li>Error Highlights: VS Code + PIO underlines errors in your code before compiling;<\/li>\n\n\n\n<li>Multiple open tabs: you can have several code tabs open at once;<\/li>\n\n\n\n<li>You can hide certain parts of the code;<\/li>\n\n\n\n<li>Advanced code navigation;<\/li>\n\n\n\n<li>And much more&#8230;<\/li>\n<\/ul>\n\n\n\n<p>If you\u2019re looking for a more advanced IDE to write your applications for the ESP32 and ESP8266 boards, VS Code with the PlatformIO IDE extension is a great option.<\/p>\n\n\n\n<p>We hope you&#8217;ve found this tutorial useful. If you like ESP32 and ESP8266, check the following resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">Learn ESP32 with Arduino IDE (eBook + course)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\">Home Automation using ESP8266 (eBook)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">More ESP32 Projects and Tutorials&#8230;<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp8266\/\">More ESP8266 Projects and Tutorials&#8230;<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to program the ESP32 and ESP8266 NodeMCU boards using VS Code (Microsoft Visual Studio Code) with PlatformIO IDE extension. We cover how to install the software on Windows, &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/vs-code-platformio-ide-esp32-esp8266-arduino\/#more-99203\" aria-label=\"Read more about Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":99353,"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,299,264],"tags":[],"class_list":["post-99203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32","category-esp32-project","category-0-esp32","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/09\/Getting-Started-Visual-Studio-VS-Code-PlatformIO-IDE-ESP32-ESP8266-NodeMCU-Windows-Mac-OS-X-Linux-Ubuntu.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\/99203","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=99203"}],"version-history":[{"count":2,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/99203\/revisions"}],"predecessor-version":[{"id":149299,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/99203\/revisions\/149299"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/99353"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=99203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=99203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=99203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}