from machine import Pin
import utime
led_rojo = Pin(2, Pin.OUT)
led_verde = Pin(4, Pin.OUT)
led_azul = Pin(5, Pin.OUT)
while True:
comando = input("Ingresa comando: ").strip().lower()
if comando == "rojo on":
led_rojo.on()
print("LED rojo encendido")
elif comando == "rojo off":
led_rojo.off()
print("LED rojo apagado")
elif comando == "verde on":
led_verde.on()
print("LED verde encendido")
elif comando == "verde off":
led_verde.off()
print("LED verde apagado")
elif comando == "azul on":
led_azul.on()
print("LED azul encendido")
elif comando == "azul off":
led_azul.off()
print("LED azul apagado")
elif comando == "todo off":
led_rojo.off()
led_verde.off()
led_azul.off()
print("Todos los LEDs apagados")
else:
print("Comando no válido")