We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

树莓派 官方文档

MicroPython

What is MicroPython?

Drag-and-Drop MicroPython

MicroPython 640x360 v2

Download the correct MicroPython UF2 file for your board:

For more information about using Wi-Fi and Bluetooth on Raspberry Pi Pico W-series devices with C/C++ or MicroPython, see Connecting to the Internet with Raspberry Pi Pico W-series.

For more information about supported Bluetooth protocols and profiles, see the Blue Kitchen BTStack Github repository.

Note
MicroPython distributions for other RP2040- and RP2350-based boards are available on the MicroPython download page.

To program your device, follow these steps:

  1. Push and hold the BOOTSEL button while connecting your Pico with a USB cable to a computer. Release the BOOTSEL button once your Pico appears as a Mass Storage Device called RPI-RP2.

  2. Drag and drop the MicroPython UF2 file onto the RPI-RP2 volume. Your Pico will reboot. You are now running MicroPython.

  3. Access the REPL via USB Serial.

The Raspberry Pi Pico-series Python SDK book contains step-by-step instructions for connecting to your Pico and programming it in MicroPython using both the command line and the Thonny IDE.

Where can I find documentation?

Raspberry Pi Pico Python SDK

A MicroPython environment for RP2040 microcontrollers

Connecting to the Internet with Raspberry Pi Pico W

Getting Raspberry Pi Pico W online with C/C++ or MicroPython

RP2 Quick Reference

The official documentation around the RP2040 port of MicroPython

RP2 Library

The official documentation about the rp2 module in MicroPython

Which hardware am I running on?

import network
if hasattr(network, "WLAN"):
   # the board has WLAN capabilities

Alternatively, you can inspect the MicroPython firmware version to check whether it was compiled for Raspberry Pi Pico or for Pico W using the sys module.

>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 19, 1), _machine='Raspberry Pi Pico W with RP2040', _mpy=4102)

If the 'Pico W' string is present and in sys.implementation._machine, your firmware was compiled for Pico W.