Skip to content

Instantly share code, notes, and snippets.

@DeflateAwning
Last active October 18, 2025 21:59
Show Gist options
  • Select an option

  • Save DeflateAwning/cfc26095d25390fcd3c619176c7bf23e to your computer and use it in GitHub Desktop.

Select an option

Save DeflateAwning/cfc26095d25390fcd3c619176c7bf23e to your computer and use it in GitHub Desktop.
RP2040-Zero with MicroPython Setup Guide

RP2040-Zero with MicroPython Setup Guide

Initial Setup (Do Once)

  1. Install VS Code.
  2. In VS Code, install the "MicroPico" extension.
  3. Download the MicroPython firmware from: https://micropython.org/download/RPI_PICO/RPI_PICO-latest.uf2
  4. Connect the RP2040-Zero to the computer. If a USB Drive doesn't appear, press: reset-down, boot-down, reset-up, boot-up.
  5. Open the USB Drive that appeared. Copy on the MicroPython uf2 file. Wait 30 seconds.
  6. Optional: Run pip install micropython-rp2-rpi_pico-stubs to install Python type checking helpers.
    • This install the type hints required for the import machine package.

Using the RP2040

  1. Use Device Manager (or SerialTest) to see that a new USB Serial Device appeared.
  2. In VS Code with MicroPython, see that it's connected (see the status bar at the very bottom).
    • If the status bar at the very bottom doesn't have a "Run" button, press Ctrl+Shift+P, and pick "MicroPico: Connect".
  3. Copy the rp2040_zero_onboard_led_example.py file from this gist into a file. Name it main.py.
  4. Run the firmware in this repo by pressing "Run".
    • Note that this is a one-time run, and is not a persistent "flashing" operation like a normal microcontroller.

Installing a Program to the RP2040

  • Use Ctrl+Shift+P -> "MicroPico: Upload project to Pico" to upload a project to the RP2040, such that it persists across reboots.

Factory Resetting the RP2040-Zero

To reset the RP2040-Zero so that you can install a new program on it:

  1. Download the flash_nuke.uf2 file.
  2. Copy that file to the mounted USB Drive. Let it reboot.
  3. Copy the MicroPython firmware from steps above to the mounted USB Drive. Let it reboot.

Resources:

import time
from machine import Pin
from neopixel import NeoPixel
onboard_led_pin = Pin(16, Pin.OUT)
def setup() -> None:
...
def set_led_color(r: int, g: int, b: int) -> None:
"""Display a color on the LED.
Values should be between 0 and 255.
"""
np = NeoPixel(onboard_led_pin, 1)
np[0] = (r, g, b)
np.write()
def loop() -> None:
print("Basic LED Example")
brightness = 31
colors = [
(brightness, 0, 0),
(0, brightness, 0),
(0, 0, brightness),
(brightness, brightness, 0),
(0, brightness, brightness),
(brightness, 0, brightness),
(brightness, brightness, brightness),
(0, 0, 0),
]
for color in colors:
set_led_color(r=color[0], g=color[1], b=color[2])
time.sleep_ms(500)
# Run `setup` and `loop`.
setup()
while True:
loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment