from machine import Pin
from utime import sleep
import_thread
led_red = Pin(15, Pin.OUT)
led_amber = Pin(14, Pin.OUT)
led_green = Pin(13, Pin.OUT)
button = Pin(16, Pin.IN, Pin.PULL_DOWN)
buzzer = Pin(12, Pin.OUT)
global button_pressed
button_pressed = False
while True:
print(button.value())
if button.value() == 1:
led_red.value(1)
for i in range(10):
buzzer.value(1)
sleep(0.2)
buzzer.value(0)
sleep(0.2)
led_red.value(1)
sleep(5)
led_amber.value(1)
sleep(2)
led_red.value(0)
led_amber.value(0)
led_green.value(1)
sleep(5)
led_green.value(0)
led_amber.value(1)
sleep(5)
led_amber.value(0)