Pico – Developing for Raspberry Pi Pico (W) with Python and Visual Studio Code

This artice assumes that you already have basic knowledge of Visual Studio Code.

Installation

Installation on the Raspberry Pi Pico (W) board

  • Install MicroPython firmware on Raspberry Pi (W)
    See MicroPython documentation for installation instructions, search for ‘Drag-and-Drop MicroPython’.

Installation on the development PC

  • Start VS Code and install the following extensions:
    • Python
    • Pico-Go
    • Pylance (optional)
    • IntelliCode (optional)

First project

Create a new empty folder for your project.

Start VS Code and open this filder (menu: File -> Open Foleder…

After a short time you should see the Pico-Go command icons in the blue bottom status bar (Run, Upload, All commands, etc.). Click All commands and select Pico-Go > Configure project. Alternatively you can open the command palette of VS Code (Shift-Ctrl-P) and enter Pico-Go > Configure project. This creates some files in your project directory.

Connect the Raspberry Pi Pico (W) using the USB calble to your development PC. After a short time you should see in VS Code’s TERMINAL the follwoing message:
Connecting to COMx… (where x is a number)
… and the blue status bar shows ‘Pico connected’.

No you are ready to create your first MicroPython program for Raspberry Pi Pico (W). In VS Code’s EXPLORER create a new fiel with the extension .py and enter your source code. While editing auto-completion and IntelliSense we will assist you.

To download and start you program klick the Run icon in blue bottom status bar.

To stop the program, click the Stop icon in the blue status bar.

Comments

After my very short experience on Windows 11: The Pico-Go extension still behaves sometimes a bit unstable. Sometimes the Pico board is not recognized when plugging on, or the Pico console (REPL terminal) hangs.

And the biggest disadvantage from my point of view is that no debugging with breakpoints, single step, variable inspection etc. is supported.

The big advantage compared to Thonny and similar IDEs is the professional development environment of Visual Studio Code (auto-completion, IntelliSense, refactoring, navigation (e.g. ‘Go to Definition’), error detection, Git integration, etc.).