9/3/2023 0 Comments Spyder or thonny![]() 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. Sudo apt update & sudo apt full-upgrade -y Code Hello World in MicroPython If you don’t see MicroPython (Raspberry Pi Pico) in the interpreter list, you’ll need to update Thonny. ![]() 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. The best way to program in MicroPython on your Raspberry Pi Pico is with the Thonny Python IDE (integrated development environment). After a few seconds, the drive will disappear as the new MicroPython firmware is recognised and installed. Drag-and-drop the UF2 file to the Raspberry Pi Pico’s removable drive (named ‘RPI-RP2’). Open File Manager and locate the micropython-1.uf2 file in the Downloads folder (the file name may have been updated with a later date). It’s a small file, so it’ll only take a few seconds. Choose the ‘Getting started with MicroPython’ tab, and click ‘Download UF2 file’ to download the MicroPython firmware. Your browser will open and display the ‘Welcome to your Raspberry Pi Pico’ webpage. Flash the MicroPython firmwareĭouble-click the INDEX.HTM file displayed in Pico’s mounted storage. Click OK in the ‘Removable medium is inserted’ window to open Raspberry Pi Pico’s on-board storage. You will see your computer mount a removable drive. Wait a few seconds, then let go of the BOOTSEL button. Hold down the small button on your Raspberry Pi Pico marked ‘BOOTSEL’ and plug the larger USB-A cable end into your computer (we are using a Raspberry Pi). Take your Raspberry Pi Pico and a micro USB to USB-A cable, and connect the small micro USB end of Pico. In this tutorial we’re going to switch the Pico firmware from C/C++ to MicroPython and create our first program, which flashes the LED on the board. However, there’s a more beginner-friendly method: MicroPython, a port of the Python programming language designed specifically for microcontrollers. The C/C++ SDK is an extremely flexible and powerful way to interact with your Raspberry Pi Pico. Raspberry Pi Pico is set up, by default, for use with the C/C++ Software Development Kit (SDK). Program Raspberry Pi Pico with MicroPython Make sure to read, and bookmark, these new Raspberry Pi Pico and 2040 data sheets. Makers looking to explore the C/C++ SDK should download the Pico C/C++ SDK documentation. Get Started with MicroPython on Raspberry Pi Pico is available now from Raspberry Pi Press. As well as learning how to use Raspberry Pi Pico’s pins as inputs and outputs, you’ll build a simple game, measure temperatures, save and load data to your Pico’s file system, and even make a burglar alarm for your room. Get Started with MicroPython on Raspberry Pi Picoįor more physical computing projects to try on your Raspberry Pi Pico, grab a copy of the new book, Get Started with MicroPython on Raspberry Pi Pico. Additionally, the C/C++ SDK provides higher-level libraries for dealing with timers, USB, synchronisation, and multicore programming, along with additional high-level functionality built using PIO such as audio.īeginners looking to get started with the MicroPython port should start with the Raspberry Pi Pico Python SDK documentation and be sure to pick up a copy of Getting Started with MicroPython on Raspberry Pi Pico. Meanwhile, the C/C++ SDK is fine-tuned to RP2040 and has all the headers, libraries, and build systems necessary to write programs in C, C++, or assembly language. Programs written for other MicroPython-compatible microcontroller boards will work on Raspberry Pi Pico, and vice versa – sometimes needing minor modification for different features between boards – giving Raspberry Pi Pico a healthy library of projects and tutorials beyond those developed by Raspberry Pi itself. You can pick up a Raspberry Pi Pico from just $4 / £3.60, or free with the latest edition of HackSpace magazine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |