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)