Skip to content

First LED Blink - GPIO Basics on Pico

Beginning of the lesson

First LED Blink - GPIO Basics on Pico

Making a light turn on and off with code is the "Hello, World!" of electronics. In this lesson you will control a tiny light called an LED using your Raspberry Pi Pico, and by the end you will understand exactly why every line of code and every wire does what it does.

The Big Idea

Your Raspberry Pi Pico is a small computer on a single board called a microcontroller. Around its edges are metal pins. Some of these pins are called GPIO pins, and they are the way the Pico "touches" the outside world. GPIO stands for General Purpose Input/Output. "General purpose" means you decide what each pin does. "Output" means the pin can push electricity out to control something like a light or a motor. "Input" means the pin can sense electricity coming in, for example from a button. In this very first lesson we only use output, and the thing we control is an LED (a Light-Emitting Diode - a small, cheap light).

Here is the whole idea in one sentence: we write MicroPython code that tells a GPIO pin to send out voltage, wait a moment, stop sending voltage, wait again, and repeat forever - and that makes an LED blink.

What You Will Learn
  • What a GPIO pin is, and what "digital output HIGH and LOW" really means in volts.
  • How to blink the LED that is already built into the Pico, with no wiring at all.
  • Every MicroPython command you need: from machine import Pin, Pin(25, Pin.OUT), value(1), value(0), toggle(), and time.sleep().
  • How to write a blink loop with while True and how to change the blink speed.
  • How to wire an external LED on a breadboard, which leg is which, and how to choose the correct resistor using Ohm's Law.
  • How to make the program run on its own using main.py, and how to fix the most common beginner problems.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers