yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
Raspberry Pi Pico 2📖
1. About Pico 2
  • Introduction to Raspberry Pi PICO 2
2. Development-python
  • 1. Flash the firmware
  • 2. Software environment configuration
  • 3. Download a program
3. Development-C
  • 1. Software environment configuration
  • 2. Download a program
4. Python course
  • 1. Flash the onboard LED light
  • 2. Onboard temperature sensor reading
  • 3. Button control LED light
  • 4. Buzzer
  • 5. PWM pin
5. C course
  • 1. Flash the onboard LED light
  • 2. Onboard temperature sensor reading
  • 3. Button control LED light
  • 4. Buzzer
  • 5. PWM pin
Download
  • C software
  • Python software
  • Official information
Download ZIP

Welcome to Raspberry Pi Pico 2 repository

1. Flash the onboard LED light

1. Flashing the onboard LED light

1. Flashing the onboard LED light1. Learning objectives2. Hardware construction3. Program analysis4. Experimental Phenomenon

1. Learning objectives

  1. Learn the basic use of the pins of the Raspberry Pi Pico 2 .
  2. Learn how to control the onboard LED light.

2. Hardware construction

This course does not require additional hardware equipment and can directly use the onboard LED light on the Raspberry Pi Pico 2 motherboard.

image-20240909153108003

3. Program analysis

Thonny programming

For the use of ThonnyIDE, please refer to the previous environment construction related courses.

​x
import machine
import utime
​
led_onboard = machine.Pin(25, machine.Pin.OUT)
​
while True:
  led_onboard.value(1)
  utime.sleep(5)
  led_onboard.value(0)
  utime.sleep(5)

import machine

The machine library contains all the instructions MicroPython needs to communicate with the Pico 2 and other MicroPython-compatible devices, extending the language of physical computing.

 

import utime

The "utime" library. This library handles everything to do with time, from measuring it to inserting delays into your program. The units are in seconds.

 

led_onboard = machine.Pin(25, machine.Pin.OUT)

The first argument, 25, is the number of the pin you are setting; the second argument, machine.Pin.OUT tells the Pico 2 that the pin should be used as an output rather than an input.

 

utime.sleep(5)

This calls the sleep function from the utime library, which will cause the program to pause for whatever number of seconds you type - in this case, 5 seconds.

 

4. Experimental Phenomenon

After the program is downloaded, we can see that the LED on the Raspberry Pi Pico 2 development board flashes every 5 seconds.

Download a program
Onboard temperature sensor reading

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文