Raspberry Pi Pico
The Raspberry Pi Pico is a small yet powerful microcontroller that is based on the RP2040 chip. It is an excellent choice for hobbyists and professionals who need a reliable and low-cost microcontroller board.
One of the standout features of the Raspberry Pi Pico is its dual-core ARM Cortex M0+ processor. This processor provides excellent performance and makes the board suitable for a wide range of applications. Additionally, the board has an on-board temperature sensor, which makes it suitable for projects that require temperature sensing.
Another impressive feature of the Raspberry Pi Pico is its 26 multi-function GPIO pins. These pins can be used to connect the board to a wide range of devices, including sensors, actuators, and other microcontrollers. This makes the board highly versatile and suitable for many different types of projects.
Learn More 👉 Raspberry Pi Pico
Steps to use CircuitPython with VS Code
The following steps will help you to write code on Pi Pico using CircuitPython & VS Code.
1. Download and upload CircuitPython
- Download the
.uf2file for Raspberry Pi Pico from Pico Download (circuitpython.org).
- Push and hold the BOOTSEL button on the Pi Pico and plug in the USB cable.
- The Pi Pico will be mounted as a mass storage device (RPI-RP2) on the computer.
- Copy the
.uf2file to the RPI-RP2 volume.
Learn More 👉 CircuitPython
2. Download VS Code and install CircuitPython extension
- Download VS code from Visual Studio Code.
- Install the
CircuitPythonextension by joedevivo from VS Code Marketplace.
3. Write Code
- Open a new directory in VS Code.
- Open the command palette and select
CircuitPython: Select Serial Port.
- Select the COM port of your Pi Pico (for example,
- Create a Python file in the root directory (for example,
- Write your code in the file.
The following code sample will blink the LED on the Pi Pico board.
# build-in LED blink in Pi Pico using CircuitPython import time import board import digitalio led = digitalio.DigitalInOut(board.LED) led.direction = digitalio.Direction.OUTPUT # set the direction of the pin while True: led.value = True # turn the LED on time.sleep(0.5) # wait for 0.5 seconds led.value = False # turn the LED off time.sleep(0.5) # wait for 0.5 seconds
4. Upload code to Pi Pico
- If you are using Windows, open a new terminal and run the following command.
$currDir = Get-Location $targetDir = "E:" Remove-Item $targetDir* -Recurse -Force Copy-Item $currDir* $targetDir -Recurse -Force
- If you are using Linux, open a new terminal and run the following command.
cp -r * /media/$USER/RPI-RP2
- "Raspberry Pi Documentation - Raspberry Pi Pico and Pico W" Raspberrypi, https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html.
- "CircuitPython" Circuitpython, https://circuitpython.org/.