There is an LED built onto the Pico that we can control from a program.

C Interface

Documentation

// Inbuilt LED is controlled by the cyw43 wireless module.
#include "pico/cyw43_arch.h"
 
// Initialise the wireless module
int cyw43_arch_init(void);
 
// Put a value onto a GPIO pin
// The builtin LED pin is defined in CYW43_WL_GPIO_LED_PIN
void cyw43_arch_gpio_put(uint wl_gpio, bool value);

Instructions

Look at the onboard-led.cpp file to see how to control the onboard LED.

The LED is green and is just next to the USB port on the Pico.

A difference on the Pico 2 W is that the LED is connected through the wireless module, rather than directly to a GPIO pin. This means we need to initialise the cyw43 module before we can use the LED.

Exercise

Exercise

Can you integrate the LED with the Serial Monitor to control the LED from your computer?