Pi pico pioneer platform

Hi Tim,

This is a very simple traffic light board that you could use. You will just need a resistor off the ground pin and some more wires to connect it to your Pico.

From there you’ll just be writing some pins high and low to turn the lights on and off. Here is some example code that may work but it will be even better to work towards it yourself. You will learn plenty along the way.

import machine
import utime

# LED pin assignments
red_led = machine.Pin(15, machine.Pin.OUT)
yellow_led = machine.Pin(14, machine.Pin.OUT)
green_led = machine.Pin(13, machine.Pin.OUT)

# Function to turn on a specific LED
def turn_on_led(led):
    led.value(1)

# Function to turn off a specific LED
def turn_off_led(led):
    led.value(0)

while True:
    # Red light for 5 seconds
    turn_on_led(red_led)
    utime.sleep(5)
    turn_off_led(red_led)

    # Yellow light for 2 seconds
    turn_on_led(yellow_led)
    utime.sleep(2)
    turn_off_led(yellow_led)

    # Green light for 5 seconds
    turn_on_led(green_led)
    utime.sleep(5)
    turn_off_led(green_led)

We also have this forum post where someone was after something quite similar with a button as well.