import machine
import utime

slide_pot_pin = machine.ADC(26)  
buzzer_pin = machine.Pin(14, machine.Pin.OUT)
green_led_pin = machine.Pin(15, machine.Pin.OUT)

while True:
    pot_value = slide_pot_pin.read_u16()  # Membaca nilai analog

    if pot_value > 32768:  # Nilai potensiometer > 80%
        # Hidupkan buzzer
        buzzer_pin.on()
        # Matikan LED hijau
        green_led_pin.off()
    else:
        # Matikan buzzer
        buzzer_pin.off()
        # Hidupkan LED hijau
        green_led_pin.on()

    utime.sleep(0.1)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT