from maix.peripheral import adc
from maix import time

a = adc.ADC(0, adc.RES_BIT_12)

while True:
    # raw_data = a.read()
    # print(f"ADC raw data:{raw_data}")
    # if raw_data > 2450:
    #     print(f"ADC raw data:{raw_data}")
    # elif raw_data < 2000:
    #     print(f"ADC raw data:{raw_data}")
    time.sleep_ms(1)

    vol = int(a.read_vol() * 10) / 10
    print(f"ADC vol:{vol:.1f}, {time.time():.4f}")
