from machine import Pin 
import utime 

# Konfigurasi pin 
BUZZER = Pin(15, Pin.OUT) 
Button1 = Pin(1, Pin.IN, Pin.PULL_UP) 
Button2 = Pin(4, Pin.IN, Pin.PULL_UP) 

def buzz(duration): 
    BUZZER.value(1)  # Nyalakan buzzer 
    utime.sleep_ms(duration) 
    BUZZER.value(0)  # Matikan buzzer 

while True: 
    Button1State = Button1.value() 
    Button2State = Button2.value() 
    
    # Jika kedua tombol ditekan secara bersamaan
    if Button1State == 0 and Button2State == 0: 
        print("Saat kedua tombol ditekan, buzzer aktif selama 5 detik") 
        buzz(5000)  # Durasi buzzer diubah menjadi 5 detik (5000 ms)
    
    utime.sleep_ms(1)  # Debounce sederhana
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT