{"id":108992,"date":"2022-02-22T13:56:08","date_gmt":"2022-02-22T13:56:08","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=108992"},"modified":"2022-02-22T13:56:11","modified_gmt":"2022-02-22T13:56:11","slug":"micropython-program-esp32-esp8266-mu-editor","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/micropython-program-esp32-esp8266-mu-editor\/","title":{"rendered":"MicroPython: Program ESP32\/ESP8266 using Mu Editor"},"content":{"rendered":"\n<p>In this guide, you&#8217;ll learn how to use Mu Editor software to program your ESP32 and ESP8266 boards using MicroPython. <\/p>\n\n\n\n<p>Mu Editor is a simple Python editor for beginner programmers that supports MicroPython with the ESP32 and ESP8266 boards. It works pretty well, comes with a simple and intuitive interface, and provides a menu to burn firmware to your boards quickly.<\/p>\n\n\n\n<div class=\"wp-block-image\"><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\/2022\/01\/Mu-Editor-thumbnail.png?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Program ESP32 ESP8266 NodeMCU using Mu Editor\" class=\"wp-image-108996\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-thumbnail.png?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-thumbnail.png?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-thumbnail.png?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-thumbnail.png?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Contents:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#Micropython-Intro\">MicroPython Introduction<\/a><\/li><li><a href=\"#installing-Mu-Editor\">Installing Mu Editor<\/a><\/li><li><a href=\"#Mu-Editor-Overview\">Mu Editor Overview<\/a><\/li><li><a href=\"#flash-micropython\">Flashing MicroPython Firmware<\/a><\/li><li><a href=\"#running-micropython-script-mu-editor\">Running Your First Script<\/a><\/li><\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"Micropython-Intro\">What is MicroPython?<\/h1>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"250\" height=\"254\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?resize=250%2C254&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Logo\" class=\"wp-image-75088\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?w=250&amp;quality=100&amp;strip=all&amp;ssl=1 250w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2018\/10\/Micropython-logo.svg-Copy.png?resize=80%2C80&amp;quality=100&amp;strip=all&amp;ssl=1 80w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/figure><\/div>\n\n\n\n<p>MicroPython is a Python 3 programming language re-implementation targeted for microcontrollers and embedded systems. MicroPython is very similar to regular Python. Apart from a few exceptions, the language features of Python are also available in MicroPython. The most significant difference between Python and MicroPython is that MicroPython was designed to work under constrained conditions.<\/p>\n\n\n\n<p>Because of that, MicroPython does not come with the entire pack of standard libraries. It only includes a small subset of the Python standard libraries, but it includes modules to easily control and interact with the GPIOs, use Wi-Fi, and other communication protocols.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-Mu-Editor\">Installing Mu Editor<\/h2>\n\n\n\n<p>Mu Editor is a simple Python editor for beginners. As mentioned on the Mu Editor website, \u201c<em>Less is More: Mu has only the most essential features, so users are not intimidated by a baffling interface.<\/em>\u201d<a href=\"https:\/\/codewith.mu\/\" target=\"_blank\" rel=\"noreferrer noopener\">[Mu Editor Webpage]<\/a><\/p>\n\n\n\n<p>Installing Mu Editor is very straightforward. Follow the next steps:<\/p>\n\n\n\n<p><strong>1)<\/strong> Go to the following website and download Mu Editor for your operating system: <a href=\"https:\/\/codewith.mu\/en\/download\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/codewith.mu\/en\/download<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"708\" height=\"686\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Mu-Editor.png?resize=708%2C686&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Downloading Mu Editor MicroPython programming\" class=\"wp-image-108993\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Mu-Editor.png?w=708&amp;quality=100&amp;strip=all&amp;ssl=1 708w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Mu-Editor.png?resize=300%2C291&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 708px) 100vw, 708px\" \/><\/figure><\/div>\n\n\n\n<p><strong>2)<\/strong> Run the installer you\u2019ve just downloaded\u2014it\u2019s probably in your <em>Downloads<\/em> folder.<\/p>\n\n\n\n<p><strong>3)<\/strong> Finally, follow the on-screen instructions to install it.<\/p>\n\n\n\n<p>If you have trouble with the installation, look at the official instructions on the Mu Editor website: <a href=\"https:\/\/codewith.mu\/en\/howto\/\" target=\"_blank\" rel=\"noreferrer noopener\">Mu Editor Installation Guides<\/a>.<\/p>\n\n\n\n<p>And that\u2019s it. It couldn\u2019t be simpler.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Mu-Editor-Overview\">Mu Editor Overview<\/h2>\n\n\n\n<p>Open Mu Editor. The following window will open.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"572\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Overview.png?resize=962%2C572&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Overview\" class=\"wp-image-108998\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Overview.png?w=962&amp;quality=100&amp;strip=all&amp;ssl=1 962w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Overview.png?resize=300%2C178&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Overview.png?resize=768%2C457&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/figure><\/div>\n\n\n\n<p>You can see that the interface is very simple and intuitive to use. Let\u2019s take a quick look at the buttons.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Mode<\/strong>: choose which mode you want to use.  Select ESP MicroPython<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"432\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-modes.png?resize=602%2C432&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Modes\" class=\"wp-image-109013\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-modes.png?w=602&amp;quality=100&amp;strip=all&amp;ssl=1 602w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-modes.png?resize=300%2C215&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>New<\/strong>: creates a new file.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Load<\/strong>: chooses a file to load into Mu.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Save<\/strong>: saves the file to your computer.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Run<\/strong>: runs the current script in your ESP32 or ESP8266 boards <u>without<\/u> actually uploading code to the board.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>File<\/strong>: opens a window with the files saved on your board filesystem and a window with the files saved on your computer&#8217;s current directory.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>REPL<\/strong>:&nbsp; allows you to talk to the ESP32 or ESP8266 by writing commands that the board will run right away. REPL means <strong>R<\/strong>ead, <strong>E<\/strong>valuate, <strong>P<\/strong>rint, <strong>L<\/strong>oop. The ESP32\/ESP8266 waits for instructions by presenting <span class=\"rnthl rntliteral\">&gt;&gt;&gt;<\/span> in the REPL. You should type your commands and hit Enter. The ESP will get the commands and send a response.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Plotter<\/strong>: provides a graphical interface to display and plot values.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Zoom-in<\/strong>: increases code font size.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Zoom-out<\/strong>: decreases code font size.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Theme<\/strong>: changes between different themes.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Check<\/strong>: checks your code for errors.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Tidy<\/strong>: tidies up your code when it comes to spaces and indentation.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Help<\/strong>: opens Mu Editor website help page.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Quit<\/strong>: closes Mu Editor.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"flash-micropython\">Flashing MicroPython Software<\/h2>\n\n\n\n<p>MicroPython isn\u2019t flashed onto the ESP32 or ESP8266 boards by default. The first thing you need to do to start programming your boards with MicroPython is flash\/upload\/burn the firmware.<\/p>\n\n\n\n<p>There are different ways in which you can do that. Mu Editor comes with a tool that allows you to quickly install MicroPython firmware on your board. Another method is using esptool\u2014check <a href=\"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/\">this tutorial to burn MicroPython firmware with esptool.py<\/a> if you have trouble flashing the firmware with Mu Editor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Downloading MicroPython Firmware<\/h3>\n\n\n\n<p>Go to the MicroPython Downloads page: <a href=\"https:\/\/micropython.org\/download\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/micropython.org\/download\/<\/a>.<\/p>\n\n\n\n<p>Select the type of board you\u2019re using. Here are the quick links for \u201cregular\u201d ESP32 and ESP8266 boards:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/micropython.org\/download\/esp32\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 MicroPython firmware<\/a><\/li><li><a href=\"https:\/\/micropython.org\/download\/esp8266\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP8266 MicroPython firmware<\/a><\/li><\/ul>\n\n\n\n<p>You should see a similar web page (see figure below) with links to download <span class=\"rnthl rntliteral\">.bin<\/span> files. Download the latest release.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"538\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=461%2C538&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Download MicroPython Firmware\" class=\"wp-image-108999\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?w=461&amp;quality=100&amp;strip=all&amp;ssl=1 461w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Download-Micropython-firmware.png?resize=257%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 257w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/figure><\/div>\n\n\n\n<p>At the time of writing this article, the latest release is <strong><em>v1.17 (2021-09-02).bin<\/em><\/strong> for the ESP32 and ESP8266 boards. Don\u2019t download the Nightly builds; those versions are not stable and are only recommended for advanced programmers.<\/p>\n\n\n\n<p>The downloaded file will probably go to the <em>Downloads<\/em> folder. Continue reading to learn how to flash the firmware on your boards.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flashing MicroPython Firmware using Mu Editor<\/h3>\n\n\n\n<p>In this section, you\u2019ll learn how to flash MicroPython firmware on your boards using Mu Editor. Follow the next steps:<\/p>\n\n\n\n<p><strong>1)<\/strong> Connect your ESP32 or ESP8266 board to your computer.<\/p>\n\n\n\n<p><strong>2)<\/strong> Open Mu Editor. And click on the gear icon at the bottom right corner.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"445\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Settings.png?resize=750%2C445&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Settings\" class=\"wp-image-109000\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Settings.png?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Settings.png?resize=300%2C178&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p><strong>3)<\/strong> Click on the <strong>ESP Firmware flasher <\/strong>tab. It should automatically detect an ESP32 or ESP8266 board connected to a specific COM port. If you don\u2019t see any port on the Device field, go to <a href=\"https:\/\/randomnerdtutorials.com\/esp32-troubleshooting-guide\/#COM-port-not-found\">this section of the ESP troubleshooting guide<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"521\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Administration-ESP-Flasher.png?resize=602%2C521&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-109001\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Administration-ESP-Flasher.png?w=602&amp;quality=100&amp;strip=all&amp;ssl=1 602w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Administration-ESP-Flasher.png?resize=300%2C260&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure><\/div>\n\n\n\n<p><strong>4)<\/strong> Choose your device type: ESP32 or ES8266 board. Click on the <strong>Browse<\/strong> button and select the MicroPython firmware <span class=\"rnthl rntliteral\">.bin<\/span> file you\u2019ve downloaded previously.<\/p>\n\n\n\n<p><strong>5)<\/strong> Click on <strong>Erase &amp; write firmware<\/strong> to start burning MicroPython firmware.<\/p>\n\n\n\n<p><strong>6)<\/strong> If you\u2019re using an ESP8266 board, the burning process will start automatically for most boards. If you\u2019re using an ESP32 board, you&#8217;ll probably need to hold the on\u2011board BOOT\/FLASH button for about two seconds right after clicking on the Erase &amp; Write firmware button to put your board in flashing mode.<\/p>\n\n\n\n<p><strong>7)<\/strong> After a few seconds, the process is completed\u2014see figure below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"521\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/mu-editor-burn-firmware-done.png?resize=602%2C521&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Burn Firmware Done\" class=\"wp-image-109002\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/mu-editor-burn-firmware-done.png?w=602&amp;quality=100&amp;strip=all&amp;ssl=1 602w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/mu-editor-burn-firmware-done.png?resize=300%2C260&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/figure><\/div>\n\n\n\n<p>Congratulations. You successfully flashed MicroPython firmware on your boards using Mu Editor.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"running-micropython-script-mu-editor\">Running Your First Script<\/h1>\n\n\n\n<p>At this point, we assumed that you have Mu Editor installed on your computer and the ESP32\/ESP8266 flashed with MicroPython firmware.<\/p>\n\n\n\n<p>To get you familiar with the process of writing a file and executing code on your ESP32\/ESP8266 boards, we\u2019ll upload a simple script that blinks the on-board LED of your ESP32 or ESP8266 (that corresponds to GPIO 2).<\/p>\n\n\n\n<p>After having the MicroPython firmware installed on your board and having the board connected to your computer through a USB cable, follow the next steps:<\/p>\n\n\n\n<p><strong>1)<\/strong> Press the <strong>New<\/strong> button to create a new file.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"47\" height=\"62\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-editor-new-file.png?resize=47%2C62&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor New File\" class=\"wp-image-109005\"\/><\/figure><\/div>\n\n\n\n<p><strong>2)<\/strong> Copy the following code to your newly created file (including indentation).<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\/micropython-programming-with-esp32-and-esp8266\/\n\nfrom machine import Pin\nfrom time import sleep\n\nled = Pin(2, Pin.OUT)\n\nwhile True:\n  led.value(not led.value())\n  sleep(0.5)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP-MicroPython\/raw\/master\/code\/Blink_LED\/Blink_LED.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p><strong>3)<\/strong> Press the <strong>Save<\/strong> button to save the file to your computer. Save it whenever is more convenient to you. We recommend creating a project folder to save that file, for example, called <em>Blink<\/em>. Then, save the file inside that folder. <strong>The file should be called <span class=\"rnthl rntliteral\">main.py<\/span><\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"42\" height=\"60\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-save-file.png?resize=42%2C60&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Save File\" class=\"wp-image-109007\"\/><\/figure><\/div>\n\n\n\n<p><strong>4)<\/strong> Click on the <strong>Files<\/strong> button to open your board filesystem and your project directory on your computer\u2014see figure below. There should be a file called <span class=\"rnthl rntliteral\">boot.py<\/span> already on your board. It is created by default when you burn MicroPython firmware. There\u2019s also a file called <span class=\"rnthl rntliteral\">main.py<\/span> on your computer with the code provided previously.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"572\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-editor-files-computer-device.png?resize=962%2C572&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Files\" class=\"wp-image-109008\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-editor-files-computer-device.png?w=962&amp;quality=100&amp;strip=all&amp;ssl=1 962w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-editor-files-computer-device.png?resize=300%2C178&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-editor-files-computer-device.png?resize=768%2C457&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Troubleshooting:<\/strong> If you got an error when clicking on the <strong>Files<\/strong> button (see figure below), try the following until you get a response: <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/MU-Editor-Error-Cannot-open-files.png?resize=422%2C204&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor Error opening files\" class=\"wp-image-109017\" width=\"422\" height=\"204\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/MU-Editor-Error-Cannot-open-files.png?w=844&amp;quality=100&amp;strip=all&amp;ssl=1 844w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/MU-Editor-Error-Cannot-open-files.png?resize=300%2C145&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/MU-Editor-Error-Cannot-open-files.png?resize=768%2C370&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>unplug\/plug or reset your board; <\/li><li>restart Mu Editor; <\/li><li>click on the <strong>Files <\/strong>button followed by the <strong>REPL <\/strong>button, press <strong>CTRL-C<\/strong> to stop any possible running programs on the board, then click on the <strong>Files <\/strong>button again. Try this several times until you got a response.<\/li><\/ul>\n\n\n\n<p><strong>5)<\/strong> To upload code to your board, drag the <span class=\"rnthl rntliteral\">main.py<\/span> file from the \u201cFiles on your computer\u201d window to the \u201cFiles on your device\u201d window. Now, the <span class=\"rnthl rntliteral\">main.py<\/span> file is on your board filesystem.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"962\" height=\"634\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Upload-Files-to-Device.png?resize=962%2C634&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Mu Editor opening files on device\" class=\"wp-image-109009\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Upload-Files-to-Device.png?w=962&amp;quality=100&amp;strip=all&amp;ssl=1 962w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Upload-Files-to-Device.png?resize=300%2C198&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-Upload-Files-to-Device.png?resize=768%2C506&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Note:<\/strong> Later, if you want to make changes to your <span class=\"rnthl rntliteral\">main.py<\/span>, you should save it on your computer first. Then, drag the <span class=\"rnthl rntliteral\">main.py<\/span> again to the device window to overwrite the previous file.<\/p>\n\n\n\n<p><strong>6)<\/strong> Now, press the on-board ESP32\/ESP8266&nbsp;<strong>EN<\/strong>&nbsp;(<strong>ENABLE<\/strong>) or&nbsp;<strong>RST<\/strong>&nbsp;(<strong>RESET<\/strong>) button to restart your board. After that, it will run the code we\u2019ve just uploaded. The on\u2011board blue LED should be blinking every half a second.<\/p>\n\n\n\n<p>The following figure shows the ESP32 on-board LED light up.<\/p>\n\n\n\n<div class=\"wp-block-image\"><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\n<p>And the following figure shows the ESP8266.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP8266-blinking-LED.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 NodeMCU board Built in LED turned on HIGH\" class=\"wp-image-88063\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP8266-blinking-LED.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/08\/ESP8266-blinking-LED.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>Congratulations! You\u2019ve just written and uploaded your first MicroPython script to your ESP32\/ESP8266 board using Mu Editor software.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you&#8217;ve learned how to use Mu Editor software to program your ESP32 and ESP8266 boards using MicroPython. We have tutorials for other MicroPython IDEs that you might want to experiment with:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">uPyCraft IDE: MicroPython with ESP32\/ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-thonny-micropython-python-ide-esp32-esp8266\/\">Thonny IDE: MicroPython with ESP32\/ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-vs-code-pymakr\/\">VS Code + PyMakr: MicroPython with ESP32\/ESP8266<\/a><\/li><\/ul>\n\n\n\n<p>If you want to learn more about MicroPython with the ESP32 and ESP8266 boards, take a look at our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266 eBook<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-esp8266-micropython\/\">Free MicroPython Projects and Tutorials<\/a><\/li><\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you&#8217;ll learn how to use Mu Editor software to program your ESP32 and ESP8266 boards using MicroPython. Mu Editor is a simple Python editor for beginner programmers &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"MicroPython: Program ESP32\/ESP8266 using Mu Editor\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/micropython-program-esp32-esp8266-mu-editor\/#more-108992\" aria-label=\"Read more about MicroPython: Program ESP32\/ESP8266 using Mu Editor\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":108996,"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":[310,309,264],"tags":[],"class_list":["post-108992","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-micropython","category-0-esp32-micropython","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/01\/Mu-Editor-thumbnail.png?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/108992","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=108992"}],"version-history":[{"count":16,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/108992\/revisions"}],"predecessor-version":[{"id":109477,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/108992\/revisions\/109477"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/108996"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=108992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=108992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=108992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}