Getting started Raspberry Pi Pico [1] – LED blinking with MicroPython

I got a new model of the Raspberry Pi series released in 2021, Raspberry Pi Pico, and tried it.
Raspberry Pi Pico is a development board equipped with RP2040 microcontroller which is the dual ARM Cortex M0+ core, originally developed by the Raspberry Pi Foundation. Unlike the conventional Raspberry Pi, it cannot be equipped with Linux OS and can be developed with C / C ++ or MicroPython. First, I tried to build a development environment with MicroPython.

Preparation

The Raspberry Pi Pico I got was a board only (no accessories such as USB cable included), so I needed to prepare a USB cable (the board side connector is USB micro).
Also, download and install “Thonny Python IDE” from the official website as a software (MicroPython) development environment.

How to use

1, First, hold down the BOOTSEL button on the board and connect the Rasberry Pi Pico to your PC with a USB cable.
BOOTSEL
2, Rasberry Pi Pico looks as removable media from your PC, access index.htm in it.
Setup
You will be connected to the Rasberry Pi Pico official website, access Getting started MicroPython from the tab below. Download the Rasberry Pi Pico firmware from the link labeled Download UF2 file.
3, Copy the downloaded .uf2 format file onto Rasberry Pi Pico, which is visible as removable media. The folder of Raspberry Pi Pico will be closed and it will be displayed that the USB device has been removed, but this should be normal. 4, Start the Thonny IDE. Make sure that the environment setting at the bottom right of the screen is MicroPython (Raspberry Pi Pico).
Write the following program in the Shell tab. Then, the LED on the Raspberry Pi Pico board will light up.
from machine import Pin
led = Pin(25, Pin.OUT)
led.value(1)

As shown below, if you write 0 in the argument of led.value, the LED will turn off.
led.value(0)

References

https://www.itmedia.co.jp/news/articles/2102/16/news026_2.html
https://thonny.org/

Leave a Reply

Your email address will not be published. Required fields are marked *