Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Raspberry Pi Pico Controlled Alternating LED Indicator

View and Edit Project In Cirkit DesignerImage of Raspberry Pi Pico Controlled Alternating LED Indicator

Circuit Documentation

Summary of the Circuit

This circuit is designed around the Raspberry Pi Pico microcontroller and includes a USB power input, two LEDs (one green and one red), two resistors, and an 8-position DIP switch. The Raspberry Pi Pico is programmed to alternately turn on the red and green LEDs in a blinking pattern. The USB power supply provides the necessary power for the circuit, while the resistors limit the current to the LEDs to prevent damage. The DIP switch is included in the design but is not utilized in the current code.

Component List

Raspberry Pi Pico

Resistor (220 Ohms)

LED: Two Pin (green)

LED: Two Pin (red)

USB power

DIP Switch (8 Position)

Wiring Details

Raspberry Pi Pico

Resistor (220 Ohms)

LED: Two Pin (green)

LED: Two Pin (red)

USB power

DIP Switch (8 Position)

Documented Code

// Define the GPIO pins for the LEDs
const int redLEDPin = 17;   // GPIO pin connected to the anode of the red LED
const int greenLEDPin = 16; // GPIO pin connected to the anode of the green LED

void setup() {
  // Initialize the GPIO pins as outputs
  pinMode(redLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
}

void loop() {
  // Turn on the red LED and turn off the green LED
  digitalWrite(redLEDPin, HIGH);
  digitalWrite(greenLEDPin, LOW);
  delay(1000); // Wait for 1 second

  // Turn off the red LED and turn on the green LED
  digitalWrite(redLEDPin, LOW);
  digitalWrite(greenLEDPin, HIGH);
  delay(1000); // Wait for 1 second
}

The code is written for the Arduino IDE and is intended to be uploaded to the Raspberry Pi Pico. It sets up two GPIO pins as outputs for the red and green LEDs. In the main loop, it alternates between turning the red LED on and the green LED off, then the red LED off and the green LED on, with a one-second delay between the states.