# ♡ ∩_∩
# („• ֊ •„)♡
# | ̄U U ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
# | • Lenguajes de Interfaz en TECNM Campus ITT |
# | • Autor: Alejandro Suarez Sandoval |
# | • Fecha: 2025/05/21 |
# | • Descripción: Programa en micropython que simula un semaforo con Leds |
# | en una Raspberry Pi Pico. |
# | • Link simulación en Wokwi: https://wokwi.com/projects/431559120593267713 |
#  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
#
# ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂ ⠂⠄⠄⠂☆
# ═════════•°• Código en lenguaje MicroPython Raspberry Pi Pico•°•═══════
from machine import Pin
from time import sleep
# Definición de pines
RED_PIN = 1
YELLOW_PIN = 5
GREEN_PIN = 9
# Configurar pines como salida
red = Pin(RED_PIN, Pin.OUT)
yellow = Pin(YELLOW_PIN, Pin.OUT)
green = Pin(GREEN_PIN, Pin.OUT)
while True:
# Verde ON por 3 segundos
green.value(1)
sleep(3)
# Verde OFF, Amarillo ON por 0.5 segundos
green.value(0)
yellow.value(1)
sleep(0.5)
# Amarillo OFF, Rojo ON por 2 segundos
yellow.value(0)
red.value(1)
sleep(2)
# Amarillo ON por 0.5 segundos, luego OFF, Rojo OFF
yellow.value(1)
sleep(0.5)
yellow.value(0)
red.value(0)