MicroPython: knob dimmer
A potentiometer on GP26 sets an LED’s brightness on GP15 with PWM.

The code
# A potentiometer on GP26 (ADC 0) sets the brightness of the LED on GP15 (PWM).
# Turn the knob while it runs.
from machine import ADC, PWM, Pin
import time
knob = ADC(26)
led = PWM(Pin(15))
led.freq(1000)
while True:
level = knob.read_u16()
led.duty_u16(level)
print("level", level * 100 // 65535, "%")
time.sleep(0.2)
More like this

MicroPython: blink
MicroPython’s own firmware on the real RP2040: the LED blinks, the board prints. No build.
MicroPythonRaspberry Pi Pico

MicroPython: button and LED
A button on GP14 toggles an LED on GP15 through an interrupt.
MicroPythonRaspberry Pi Pico

Pico: blink and breathe
The Pico’s own LED blinks, an LED on GP15 breathes with PWM, the knob on GP26 sets the pace.
ArduinoRaspberry Pi Pico