Raspberry Pi Pico toggle led part 1
LED Blinking Project Using Raspberry Pi Pico (MicroPython)
Objective
⦁ To create a simple LED blinking circuit using the Raspberry Pi Pico
⦁ and control it using MicroPython.
⦁ This project is ideal for beginners in embedded systems,
⦁ helping them understand GPIO pin control and timing.
Components Required
S.N. Component Quantity
1 Raspberry Pi Pico 1
2 LED (any color) 1
3 Resistor (220Ω–470Ω) 1
4 Breadboard + Jumper Wires As required
5 Micro USB Cable 1
Circuit Description
⦁ The long leg (anode) of the LED is connected to GPIO Pin 0 of the Pico.
⦁ The short leg (cathode) connects through a resistor (220Ω) to GND.(optional)
⦁ The LED will turn on and off (toggle) at an interval of 0.5 seconds using a simple loop in
MicroPython.
Code: MicroPython for Blinking LED
from machine import Pin
from time import sleep
led = Pin(0, Pin.OUT) # LED connected to GPIO 0
while True:
led.toggle() # Turns LED on/off (toggle)
sleep(0.5) # Wait for 500 milliseconds
Working Principle
⦁ Pin(0, Pin.OUT) sets GPIO 0 as an output pin.
⦁ led.toggle() flips the LED's state – if ON, it turns OFF; if OFF, it turns ON.
⦁ sleep(0.5) introduces a delay of 0.5 seconds.
⦁ The loop runs forever, continuously blinking the LED.
Applications
⦁ Basic embedded systems training.
⦁ GPIO control demonstration using Raspberry Pi Pico.
⦁ Ideal for first MicroPython programs.
⦁ Debugging/test LED indicator in larger projects.
Advantages
⦁ Very beginner-friendly.
⦁ Minimal components needed.
⦁ Learn MicroPython and GPIO control.
⦁ Easy to expand to multiple LEDs or button control.
Limitations
⦁ Only a single LED is controlled.
⦁ No user input or feedback.
⦁ Cannot adjust blinking speed without editing code.
Ideas for Expansion
⦁ Connect a button to toggle the LED manually.
⦁ Add multiple LEDs with different blinking speeds.
⦁ Use a PWM signal for LED brightness control.
⦁ Build a traffic light or pattern system using GPIOs.
References
I do not have exact reference sites, but I referred to YouTube videos, books, and ChatGPT for understanding and building this project.
Conclusion
This simple LED blink project is the first step into hardware programming with the Raspberry Pi Pico. Once you’ve mastered this, you can move on to more advanced projects like sensor reading, button control, or matrix displays.

Comments
Post a Comment