# VS Code + Pico Setup

Use this page to connect VS Code to the Pico from the command line.

# What You Need

  • VS Code installed.
  • Python installed.
  • The starter code folder from the hackathon starter package.
  • A USB data cable. Some USB cables only charge and will not work.

# 1. Open The Starter Folder

Open a terminal.

On Windows, use PowerShell.

On Mac, use Terminal.

Go into the starter folder:

cd starter-pico2-hackathon-2026

Open it in VS Code:

code .

If code . does not work, open VS Code manually and choose File > Open Folder.

# 2. Create The Python Environment

# Windows

py -m venv .venv
.\.venv\Scripts\python -m pip install -r requirements-dev.txt

# Mac

python3 -m venv .venv
.venv/bin/python -m pip install -r requirements-dev.txt

# 3. Flash MicroPython On The Pico

Do this once for a new Pico 2.

The starter package includes this firmware file:

firmware/RPI_PICO2-20240809-v1.24.0-preview.201.g269a0e0e1.uf2

# Windows

  1. Unplug the Pico USB cable.
  2. Hold the BOOTSEL button on the Pico.
  3. Plug the Pico into the computer while still holding BOOTSEL.
  4. Release BOOTSEL when a drive appears.
  5. Open the drive. It is usually named RPI-RP2 or RP2350.
  6. Drag this file onto that drive:
firmware/RPI_PICO2-20240809-v1.24.0-preview.201.g269a0e0e1.uf2

The drive will disappear and the Pico will reboot.

# Mac

  1. Unplug the Pico USB cable.
  2. Hold the BOOTSEL button on the Pico.
  3. Plug the Pico into the computer while still holding BOOTSEL.
  4. Release BOOTSEL when a drive appears.
  5. Open the drive. It is usually named RPI-RP2 or RP2350.
  6. Copy this file onto that drive:
firmware/RPI_PICO2-20240809-v1.24.0-preview.201.g269a0e0e1.uf2

The drive will disappear and the Pico will reboot.

You can also copy the firmware from Terminal after the BOOTSEL drive appears.

If the drive is named RP2350:

cp firmware/RPI_PICO2-20240809-v1.24.0-preview.201.g269a0e0e1.uf2 /Volumes/RP2350/

If the drive is named RPI-RP2:

cp firmware/RPI_PICO2-20240809-v1.24.0-preview.201.g269a0e0e1.uf2 /Volumes/RPI-RP2/

# 4. Connect The Pico

Plug the Pico into your computer with USB.

Do not hold BOOTSEL for normal coding. BOOTSEL is only for firmware flashing.

# 5. Find The Pico Port

# Windows

.\.venv\Scripts\python -m mpremote connect list

Look for a port like:

COM4

# Mac

.venv/bin/python -m mpremote connect list

Look for a port like:

/dev/cu.usbmodem1101

# 6. Copy Support Files To The Pico

# Windows

Replace COM4 with your port:

.\.venv\Scripts\python -m mpremote connect COM4 fs cp pico_car.py sensors.py motors.py states.py :

# Mac

Replace /dev/cu.usbmodem1101 with your port:

.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 fs cp pico_car.py sensors.py motors.py states.py :

# 7. Run A Test File From Your Computer

This runs code without saving it as the Pico startup program.

# Windows

.\.venv\Scripts\python -m mpremote connect COM4 run tools/team_motor_test.py

# Mac

.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 run tools/team_motor_test.py

# 8. See Remote Values In The Terminal

This test only prints remote values. It does not drive the motors.

# Windows

.\.venv\Scripts\python -m mpremote connect COM4 run tools/team_remote_serial_test.py

# Mac

.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 run tools/team_remote_serial_test.py

Expected IR remote values:

Button Value
Up 1
Left 4
Right 6
Down 9
Sound 5

# 9. Save A Program To Run On Power-Up

Only do this when you are ready for the robot to run from battery power.

# Windows

.\.venv\Scripts\python -m mpremote connect COM4 fs cp main.py :main.py
.\.venv\Scripts\python -m mpremote connect COM4 reset

# Mac

.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 fs cp main.py :main.py
.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 reset

# Emergency Stop

# Windows

.\.venv\Scripts\python -m mpremote connect COM4 exec "import motors; motors.stop()"

# Mac

.venv/bin/python -m mpremote connect /dev/cu.usbmodem1101 exec 'import motors; motors.stop()'

# Common Problems

Problem What To Try
No Pico appears Try a different USB cable.
Port changed Run mpremote connect list again.
mpremote not found Use the .venv Python command from this page.
Access denied or port busy Close other serial monitors and try again.
Motors do not move Turn on robot battery power. USB usually powers only the Pico logic.