from machine import Pin
from utime import sleep
import _thread

rled=Pin(15,Pin.OUT)
yled=Pin(14,Pin.OUT)
gled=Pin(13,Pin.OUT)
button=Pin(16,Pin.IN,Pin.PULL_UP)
buzzer=Pin(12,Pin.OUT)

global button_status
button_status=0

def button_thread():
    global button_status
    while True:
        if button.value()==1:
            button_status=1

_thread.start_new_thread(button_thread,())

while True:
    if button_status==1:
        rled.value(1)
        for i in range(10):
            buzzer.value(1)
            sleep(0.5)
            buzzer.value(0)
            sleep(0.5)
    global button_status
    button_status=0

    rled.value(1)
    sleep(5)
    led.value(0)

    yled.value(1)
    sleep(2)
    yled.value(0)

    gled.value(1)
    sleep(5)
    gled.value(0)

    yled.value(1)
    sleep(2)
    yled.value(0)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT