#4 Way Traffic Signal
from machine import Pin
from time import sleep
Green1 = Pin(32, Pin.OUT)
Yellow1 = Pin(33, Pin.OUT)
Red1 = Pin(25, Pin.OUT)
Green2 = Pin(14, Pin.OUT)
Yellow2 = Pin(27, Pin.OUT)
Red2 = Pin(26, Pin.OUT)
Yellow3 = Pin(21, Pin.OUT)
Green3 = Pin(17, Pin.OUT)
Red3 = Pin(23, Pin.OUT)
Yellow4 = Pin(15, Pin.OUT)
Green4 = Pin(2, Pin.OUT)
Red4 = Pin(16, Pin.OUT)
while True:
Red3.off()
Red1.off()
Green1.on()
Green3.on()
# sleep(5)
Red2.on()
Red4.on()
Green2.off()
Green4.off()
print("Side 1 GO ")
print("Side 3 GO ")
sleep(5)
Red3.off()
Green1.off()
Green3.off()
Yellow3.on()
Yellow1.on()
Red2.off()
Red4.off()
Yellow2.on()
Yellow4.on()
print("Side 1 WAIT")
print("Side 3 WAIT")
sleep(3)
Yellow3.off()
Yellow1.off()
Red3.on()
Red1.on()
Yellow2.off()
Yellow4.off()
Green2.on()
Green4.on()
print("Side 1 STOP")
print("Side 3 STOP")
sleep(5)