User Tools

Site Tools


led_on_and_off

This is an old revision of the document!


LED On & Off

Jun 2026


Introduction


The Raspberry Pi Pico actually has an onboard LED that we can use for some simple Micro Python testing. Now one slight complication here is that the original Pico and the Pico 2 W use different ways to address the LED. This guide is using the Pico, where the LED is on GPIO pin 25. The way we will address the LED means that you don't really need to know the pin number.


In the above picture we can see where the LED is. Once powered on the LED by default will be off, and we will need to use some micro python to turn it on.

Lets run Thonny, and use some Micro Python code to turn on and turn off our onboard Pi Pico LED.


Here we can see the code that we need to enter in to Thonny.

download
# Import the picozero LED class
from picozero import pico_led

#Turn on the pico LED
pico_led.on()


This code does a couple of things:

from picozero import pico_led

  This line imports the pico_led object from the picozero library.
  
  picozero is a beginner‑friendly library for controlling hardware on the Raspberry Pi Pico.
  
  pico_led is a built‑in object that represents the on‑board LED (the little LED already on the Pico board).
  
  So this line is basically saying:
  
  “Give me access to the Pico’s built‑in LED so I can control it.”
led_on_and_off.1781303566.txt.gz · Last modified: by walkeradmin