import time
time.sleep(0.1) # Wait for USB to become ready
from machine import ADC,Pin
pot=ADC(Pin(26))
led=Pin(0,Pin.OUT)
while 1:
val=pot.read_u16()
volt=val/65535.0*3.3
print("adc value is",val,volt,"V")
if volt<1.0 or volt >2.0:
led.value(1)
print("led is on")
else:
led.value(0)
print("led is off")
time.sleep(0.4)