from machine import Pin, ADC
from time import sleep

adcX = ADC(2) 
oldX = 0
max_adc_value = 65535
reference_voltage = 3.3

while True:
    valX = adcX.read_u16()
    voltageX = (valX / max_adc_value) * reference_voltage
    sleep(0.5)
    if valX != oldX:
        print("X: ", round(voltageX, 2), "v")
        oldX = valX