Skip to content

davidvancl/wsl-rpi-pico-w-vscode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Developing applications for Raspberry Pi Pico W, MicroPython

  • Operating system Windows 11
  • VS Code development program needs to be installed
  • Correct firmware needs to be loaded onto the Raspberry Pi Pico W

Installing and setting up WSL

  1. Enable WSL2 on Windows

  2. Set WSL 2 as the default version - Windows console
    wsl --set-default-version 2

  3. Install Ubuntu distribution - Windows console
    wsl --install -d Ubuntu

  4. Update dependencies and upgrade the system - WSL console
    sudo apt update -y && sudo apt upgrade -y

  5. Open the directory I want to mount - WSL console
    cd /mnt/c/Users/David/Desktop/RPIPico

  6. Attach VSCode to this folder - WSL console
    code .

Installing tools for connecting USB devices

  1. Download the latest version of usbipd (currently 2.4.1)

  2. Install necessary tools for connecting to Windows - WSL console

    sudo apt install linux-tools-generic hwdata
    sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/*-generic/usbip 20
    
  3. Connect the board to USB

  4. Display connected devices - Windows console
    usbipd wsl list

  5. Attach USB device to WSL - Admin windows console
    usbipd wsl attach --busid 6-1

  6. Display connected devices inside WSL - WSL console
    lsusb

Preparing and uploading the project to the board

  1. Find the directory I want to open in VS code, which is connected to WLS - WSL console
    code .

  2. Python is already installed, but pip needs to be installed - WSL console
    sudo apt install python3-pip

  3. Install the necessary pyserial package for Python - WSL console
    pip install pyserial

  4. Install VS code extensions for Raspberry Pi Pico W - VS code

    • Pico-W-Go
    • Python
    • Pylance
    • IntelliCode
  5. Configure the project - VS code

    • CTRL + L SHIFT + P -> Pico-W-Go > Configure project
  6. Open a console in the REPL for the board - VS code

    • By clicking on the + New Console and selecting the vREPL, open the console for the board.
  7. Display the virtual file system of the board to see the files uploaded to it

    • Pico-W-Go > Toggle Virtual File System (closes existing vREPLs)
  8. Create program script.py in my local directory - VS code

    from machine import Pin
    from time import sleep
    
    led = Pin("LED", Pin.OUT)
    
    led.on()
    sleep(1)
    led.off()
    
  9. Drag and drop the program to the remote directory of the board and run it - VS code

    • Pico-W-Go > Remote > Run current file
  10. Happy Coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages