from machine import Pin, ADC
from utime import sleep_ms
# Potentiometer on pin 34
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB) # full range (0–3.3V)
pot.width(10) # 0–1023 values
while True:
val = pot.read() # Read potentiometer
# Define zones
if val < 341: # roughly 0–340
print("LEFT")
elif val < 682: # roughly 341–681
print("MIDDLE")
else: # 682–1023
print("RIGHT")
sleep_ms(200) # slow down prints