from machine import Pin
import time
buzzer = Pin(27, Pin.OUT)
button = Pin(17, Pin.IN, Pin.PULL_UP)
print("Đang chờ nhấn nút...")
while True:
if button.value() == 0:
print("Đã nhấn nút! Còi kêu...")
buzzer.value(1)
time.sleep(0.5)
buzzer.value(0)
time.sleep(0.1)