Authorized Online Retailers:

Buy from USA Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES ここでご購入を!

Raspberry Pi Pico is a small, high-speed, and versatile board that uses RP2040, a new microcontroller chip designed by Raspberry Pi in the UK. Despite its name, Raspberry Pi Pico is quite different from other Raspberry Pi products like the Raspberry Pi 2, 3, and 4 pocket computers, which run on Linux operating systems.Unlike those devices, Pico does not have an operating system. Instead, it is a low-cost, high-performance microcontroller board with flexible digital interfaces. In fact, its functionality is more similar to that of its competitor, Arduino MCU boards.

To program the Pico, you can use either C++ or MicroPython. In this tutorial, we will focus on MicroPython, as it is more beginner-friendly.

Step1 Here are the steps to download and install the MicroPython firmware on your Pico board:

  1. Download the MicroPython UF2 file from the following link: https://micropython.org/download/rp2-pico/rp2-pico-latest.uf2
  2. Push and hold the BOOTSEL button on your Pico board, and then plug it into the USB port of your Raspberry Pi or other computer. Release the BOOTSEL button after your Pico is connected.
  3. Your Pico will mount as a Mass Storage Device called RPI-RP2. Drag and drop the MicroPython UF2 file onto the RPI-RP2 volume.
  4. Your Pico will reboot, and you are now running MicroPython.

Step 2: Download and Install the Thonny Python IDE

To program your Pico with MicroPython, you will need an Integrated Development Environment (IDE). We recommend using Thonny, which is a beginner-friendly IDE that supports MicroPython.

Here are the steps to download and install Thonny Python IDE on your PC:

  1. Go to the following link: https://thonny.org/

2.Download the version of Thonny that is compatible with your operating system.And Install Thonny on your PC.

3.Now open the Thonny Python IDE, click Run to select MicroPython for Rapsberry Pi Pico as Interpreter :

Also please select the COM port which your Pico board is connected as photo.After that, click OK to save the setting.

  1.  copy following code and paste them to the coding window:
    from machine import Pin 
    from time import sleep
    led = Pin(25,Pin.OUT)
    n=0
    while True:
        led.toggle()
        print("counter is {}".format(n))
        n=n+1
        sleep(1)
    

    You will see the code in IDE as following

  2. Click the little ► button to run the Python code
  3. Click File ->Save As
    Then select Raspberry Pi Pico as destination
  4. Name the file as main.py, then click OK

Now, when you connect your Pico board to USB power, the code in the main.py file will automatically run. It’s important to note that only main.py can be executed automatically. If your Python code is saved under a different name, it cannot be executed automatically

You should now see the LED on the Pico board flashing constantly. Congratulations! You have successfully run your first Python program on the Pico!

(see the # comments in each line):

from machine import Pin #import machine library to control GPIO pins
from time import sleep #import time library to use sleep function
led = Pin(25,Pin.OUT) #Set Pin 25 in OUTPUT mode, Pin 25 is connected an internal LED integrated in the board
n=0 
while True:
    led.toggle() #make pin 25 led flash once 
    print("counter is {}".format(n)) # display flash counter in the terminal
    n=n+1
    sleep(1) #delay one second and do next flash

Learn More about parts SKU:2021005900

No. Picture Product Name Link
1 Raspberry Pi Pico Board https://osoyoo.store/products/raspberry-pi-pico-flexible-microcontroller-board-based-on-the-raspberry-pi-rp2040-dual-core-arm-cortex-m0-processor-1-pc?variant=39875307864175
2 Servo motor https://osoyoo.store/products/micro-servo-sg90-blue-for-arduino-v2-0-robot-carmodel-lacc200610?variant=31648847560815
3 Infrared Sensor Module https://osoyoo.store/products/hc-sr501-pir-motion-sensor-for-arduino?variant=31957812838511
4 RFID Module and card https://osoyoo.store/products/osoyoo-rfid-module?variant=31970646130799
5 Push Buttons and Hats https://osoyoo.store/products/push-button-and-hats-5pcs?variant=39879253131375
6 LED(6 x White, 6 x Red, 6 x Yellow, 6x Green) https://osoyoo.store/products/led-packs-for-arduino?variant=31957816442991
7 Servo motor https://osoyoo.store/products/sg90-micro-servo-for-arduino-raspberry-pi-robot?variant=31957821096047
8 Piezo Buzzer Module https://osoyoo.store/products/piezo-buzzer-module-1pcs?variant=39879251656815
9 I2C LCD Display(16×2) https://osoyoo.store/products/i2c-lcd1602-display?variant=39875437101167
10 Philips Screwdriver https://osoyoo.store/products/phillips-screwdriver?variant=31930635780207https://osoyoo.store/products/single-channel-relay-module-for-arduino-raspberry-pi?variant=31955954401391
11 Solderless Prototype Breadboard https://osoyoo.store/products/solderless-prototype-breadboard-1pcs?variant=39879255457903
12 Potentionmeter (10K adjustable resistor) https://osoyoo.store/products/potentionmeter-10k-adjustable-resistor-3pcs?variant=39879281016943
13 40Pin M to M Jumper Wires https://osoyoo.store/products/40pin-m-to-m-jumper-wires?variant=39879256539247
14 20Pin M to F Jumper wires 15cm https://osoyoo.store/products/20pin-15cm-female-to-female-cable?variant=31930663305327