from espzero import LED
from time import sleep
# Define the LED connections
red = LED(13)
amber = LED(12)
green = LED(14)
# Indicate booting period
count = 0
while count<12:
red.on()
amber.on()
green.on()
sleep(0.15)
red.off()
amber.off()
green.off()
sleep(0.15)
count = count + 1
# A function to blink the amber LED
def blink_amber():
repeat = 0
while repeat < 5:
amber.on()
sleep(0.3) # pause for 0.3 seconds
amber.off()
sleep(0.3)
repeat += 1 # Increase the repetition count
# Continue to run the traffic control command FOREVER
while True:
green.on()
amber.off()
red.off()
sleep(5)
green.off()
amber.blink(0.3, 0.3, 5, True)
red.on()
sleep(5)