Raspberry Pi Pico Introductory Examples

The following short Python programs will demonstrate essential operation of the Raspberry Pi Pico board. These use only the onboard hardware and the serial console. Each can be run by copying the program into code.py on the CIRCUITPY drive offered by the board. The text can be pasted directly from this page, or each file can be downloaded from the CircuitPython sample code folder on this site.

Hello

This is the default program included in a fresh CircuitPython installation as code.py.

Direct download: hello.py.

1print(“Hello World!”)

Blink

Direct download: blink.py.

# pico_blink.py

# Raspberry Pi Pico - Blink demo

# Blink the onboard LED and print messages to the serial console.

import board
import time
from digitalio import DigitalInOut, Direction, Pull

#---------------------------------------------------------------
# Set up the hardware: script equivalent to Arduino setup()
# Set up built-in green LED
led = DigitalInOut(board.LED)  # GP25
led.direction = Direction.OUTPUT

#---------------------------------------------------------------
# Run the main loop: script equivalent to Arduino loop()

while True:
    led.value = True
    print("On")
    time.sleep(1.0)

    led.value = False
    print("Off")
    time.sleep(1.0)

Source: Raspberry Pi Pico Introductory Examples

Scroll to Top
Scroll to Top
Read previous post:
AXIOMTEK’S-COM-EXPRESS-TYPE-6-MODULE-WITH-ENHANCED-GRAPHICS-PERFORMANCE-–-CEM521
AXIOMTEK’S COM EXPRESS TYPE 6 MODULE WITH ENHANCED GRAPHICS PERFORMANCE – CEM521

Axiomtek – a world-renowned leader relentlessly devoted in the research, development and manufacture of series of innovative and reliable industrial computer...

Close