import machine
import time
azul = machine.Pin(13, machine.Pin.OUT)
amarillo = machine.Pin(14, machine.Pin.OUT)
morado = machine.Pin(12, machine.Pin.OUT)
def encender_color(pin):
azul.off()
amarillo.off()
morado.off()
pin.on()
def semaforo():
while True:
encender_color(azul)
time.sleep(5)
encender_color(amarillo)
time.sleep(2)
encender_color(morado)
time.sleep(5)
semaforo()