Translate

How to install Micropython in Raspberry PI PICO ? | RP2040-PICO | NITHISH NAYAK

  




In this post you can learn how to setup the pico to run your first micropython code.






Vendor: Raspberry Pi
Features: Dual-core, External Flash, USB
Source on GitHub: rp2/RPI_PICO
More info: Website



Installation instructions

Flashing the uf2 file

1} Hold down the BOOTSEL button while plugging the board into USB. 

2} The uf2 file below should then be copied to the USB mass storage device that appears. 

3} Once programming of the new firmware is complete the device will automatically reset and be ready for use.


Firmware

Releases

v1.22.2 (2024-02-22) .uf2 / [Release notes] (latest)            



IDE installation

  To write,edit,test and run micropython program we need an IDE ( Integrated Development Environment ) a piece of software is to be installed in your system. Basically we use 'Thonny'
a Free and Opensource software, which allows us to do all the operations without any limitations. 




Downloads For Windows : 

Installer with 64-bit Python 3.10, requires 64-bit Windows 8.1 / 10 / 11
thonny-4.1.4.exe (21 MB)

Installer with 32-bit Python 3.8, suitable for all Windows versions since 7
thonny-py38-4.1.4.exe (20 MB)

Portable variant with 64-bit Python 3.10
thonny-4.1.4-windows-portable.zip (31 MB)

Portable variant with 32-bit Python 3.8
thonny-py38-4.1.4-windows-portable.zip (29 MB)


Micropython Code

Built-in led blink code              
import machine
from time import sleep
BUILT_IN_LED_PIN = 25

# The line below indicates we are configuring this as an output (not input)
led = machine.Pin(BUILT_IN_LED_PIN, machine.Pin.OUT)


# Main loop: Repeat the forever...
while True:
    led.high() # turn on the LED
    sleep(0.5) # leave it on for 1/2 second
    led.low()  # Turn off the LED
    sleep(0.5) # leave it off for 1/2 second

Copy and paste the above code in Thonny IDE and save this inside the Raspberry PI PICO by clicking on save button (ctrl+s), don't forget to name the file as 'main.py'. 

After that click Run button (F5) to run the code.

Result

You can see a yellow led blinking on your PICO board.