# ------------------------------------------
# PRÁCTICA 02 - Encender LED por 3 segundos
# ------------------------------------------
from machine import Pin
import time
# LED interno del Pico (no usado en esta práctica, pero declarado)
led25 = Pin(25, Pin.OUT)
# LED externo conectado al pin GP10
led10 = Pin(10, Pin.OUT)
# Botón en GP0 usando resistencia pull-down interna
# Esto mantiene el pin en LOW cuando el botón no se presiona
boton = Pin(0, Pin.IN, Pin.PULL_DOWN)
while True:
# Si el botón está presionado (valor 1)
if boton.value() == 1:
led10.on() # Enciende LED
time.sleep(3) # Lo mantiene encendido por 3 segundos
led10.off() # Apaga LED después del retardo