Back to Blog
Tools button in thonny5/11/2023 Important: when the ESP restarts, first it runs the boot.py file and afterwards the main.py.Īfter uploading the script, press the ESP EN/ RESET buttonĬongratulations, you’ve successfully uploaded a new script to your ESP32/ESP8266 using Thonny IDE. Note: uploading the code as main script will save the current file with the name main.py on the ESP, even if you have saved it in your computer with a different name. It should write the following on the Shell. Go to Device and select Upload current script as main script. Copy the following code to the main.py file: The Editor should now have a tab called main.py.ģ. Simply, click the save icon and name the file main.py.Ģ. When you open Thonny IDE for the first time, the Editor shows an untitled file. Creating the main.py file on your boardġ. To get you familiar with the process of writing a file and executing code on your ESP32/ESP8266 boards, we’ll upload a new script that simply blinks the on-board LED of your ESP32 or ESP8266. It lists all available variables in your program and their corresponding values. Something that could be very useful is the Variables tab. Go to View and you can select several tabs that provide more information. You can also customize Thonny IDE to show other useful tabs. The terminal also provides information about the state of an executing program, shows errors related with upload, syntax errors, prints messages, etc… On the MicroPython Shell you can type commands to be executed immediately by your ESP board without the need to upload new files.You can open more than one file, and the Editor will open a new tab for each file. The Editor section is where you write your code and edit your.There are two different sections: the Editor and the MicroPython Shell/Terminal: ESP32/ESP8266 flashed with MicroPython firmware.> Pin(2, Pin.OUT).value(0) Thonny IDE Overview If you’re using an ESP8266, the logic to turn on the LED works the other way around, so you should send the following command instead: Send the following commands to light up the on-board LED Now, you can send a few more commands to test. If it responded back, everything is working fine. Type the command help() in the Shell and see if it responds back. Thonny IDE should now be connected to your board and you should see the prompt on the Shell.ĥ. Otherwise, select the specific port for the board you’re using.Ĥ. You can also select the “ Try to detect automatically” option, but only if you just have one board connected to your computer at a time. Then, select your device serial port (recommended). Choose MicroPython on a generic device.ģ. Ubuntu (after running that command, you’ll need to press Enter again to install the software):īash Options and select the Interpreter tab.Ģ.Sudo apt install python3 python3-pip python3-tkĪfter having Python3, pip3, and Python3 Tkinter, you can install Thonny IDE. If you’re in Ubuntu, you can install the Python dependencies like this: First, we recommend installing these dependencies: python3, python3-pip, and python3-tk To install Thonny on your Linux computer, it depends on your Linux distribution and version, follow the next instructions for your system. A window as shown in the following figure should open. After the installation is completed, open Thonny IDE. Thonny IDE is now installed and you can double-click to open it:Ħ. Drag the “Thonny” application to your Desktop:ĥ. Download the version for Mac OS X and wait a few seconds while it downloads.Ĥ. To install Thonny on Mac OS X, follow the next instructions:Ģ. Finally, select the option “Allow apps downloaded from: Anywhere“. Type your username/password and click the “ Unlock” button.ĥ. At the bottom left corner, click the lock icon to modify your “Security & Privacy” settings:Ĥ. Follow these next instructions to enable any downloaded software to run in your Mac.ġ. For security reasons, Mac OS X blocks unknown apps to run on your computer. Since Thonny IDE is open source and downloaded from the Internet, it’s not a verified app in the App Store. After completing the installation, open Thonny IDE. Follow the installation wizard to complete the installation process. Download the version for Windows and wait a few seconds while it downloads.Ĥ. To install Thonny on your Windows PC, follow the next instructions:Ģ. It even comes installed by default with Raspbian OS for Raspberry Pi. After completing this guide, you’ll have your first LED blinking using MicroPython and Thonny IDE.It allows you to program your ESP32 and ESP8266 boards with MicroPython, and it is compatible with Windows, Mac OS X, and Linux. In this guide, we’ll introduce you to Thonny IDE.
0 Comments
Read More
Leave a Reply. |