from machine import ADC, Pin
import time
pot = ADC(26)
# 出力:GP15外部LED(Wokwiでは Pin("LED") の代わりに使用)
led = Pin(15, Pin.OUT)
# しきい値の設定(半分の位置)
THRESHOLD = 30000
while True:
value = pot.read_u16()
print(f"現在値: {value}")
if value > THRESHOLD:
led.on()
print("-> ON")
else:
led.off()
print("-> OFF")
time.sleep(0.1)