from machine import Pin, ADC
import time
time.sleep(0.1) # wait for USB to be ready
LED = Pin(14, Pin.OUT) # <-- Pin(), no solo (14, Pin.OUT)
pot = ADC(26)
print("Lectura analogica")
while True:
lectura = pot.read_u16()
voltaje = (lectura / 65535) * 3.3
print(f"{lectura} | Voltaje: {voltaje:.2f} V")
if voltaje < 2.0: # <-- if DENTRO del while
LED.value(1)
time.sleep(0.1)
else:
LED.value(1)
time.sleep(0.2)
LED.value(0)
time.sleep(0.2)