![]() That means we can also directly upload files to a device. This gives two options to save this file either to your computer or directly to your devices such as ESP32 or ESP8266. When you click on the save icon (2), this pop-up window will appear. After that copy the following code in a new file and save it by clicking the save icon (2) with the name main.py. To create a new file click on the new file icon (1). For demonstration, we will perform a simple experiment of blinking onboard LED of ESP32 and ESP8266 by following all the necessary steps Create MicroPython File in Thonny IDEįirst, we need to create a main.py file that will contain our main program code which would be executed. In this section, we will see how to create a new MicroPython file and how to upload the script to ESP32/ESP8266 using Thonny IDE. Writing Your First MicroPython Script with Thonny IDE You can tick all the tabs which you want to appear on your IDE. Click on any to customize your IDE according to your needs. By clicking this, the program code halts whichever line it currently is. It allows us to go back into play mode instead of debug mode. With this button, we can exit the debugging. This arrow button (Step Out) is also used after the debug button.With this button, we take a smaller step than the previous button and work deeply. This arrow button (Step Into) is used after the debug button.With this button, we can jump from one line or one block of code to another. This arrow button (Step Over) is used after the debug button.This helps us in detecting errors whether they are syntax or logical When we click on it the code runs and is executed. By clicking on this icon we can save our code in whatever step it is. It helps us in opening a file which was already saved in our PC. By using this button, we can create several different files and work on them at once. The first icon which shows a paper is for creating a New File.I will describe them in order of the numbers. The tools section has several different tools with different functionalities. ![]() ![]() It also displays all the errors encountered in the code as well as the state of the connection clearly. Immediate execution is achieved through this. Through this, we can give the command to the ESP board without (writing, saving, uploading) it in a separate file. The Shell section is found at the bottom. py files and can open several files at once and work on them. If you don’t see ‘MicroPython (Raspberry Pi Pico)’ in the interpreter list, you’ll need to update Thonny.The Editor section is found at the top half of the screen. Take a read of our book, Get Started with MicroPython on Raspberry Pi Pico if you want to learn more about Pico programming. ![]() Click Run to start the program on Raspberry Pi Pico. ![]() You are now ready to start writing your MicroPython code in the main window. When you press ENTER at the end of the line, you’ll see your Raspberry Pi Pico respond. You can type commands in the Shell area at the bottom of the window to have them immediately executed, or you can write a program in the main part of the window to run on-demand.Ĭlick in the Shell area, next to the > symbols, and type: Writing a program for your Raspberry Pi Pico is a lot like writing a program for your Raspberry Pi. Look at the bottom-right of the Thonny window for the word ‘Python’ followed by a version number: that’s your current interpreter.Ĭlick ‘Python’ and look through the list that appears for ‘MicroPython (Raspberry Pi Pico)’ – or, if you’re running an older version of Thonny, ‘MicroPython (generic)’. Thonny is normally used to write programs that run on the same computer you’re using Thonny on to switch to writing programs on your Raspberry Pi Pico, you’ll need to choose a new Python interpreter. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |