MantisIDE

Read a sensor voltage (ADC)

Guide by MantisIDE Team · Fri Nov 27 2026 · 0 points · 0 comments

Read an analog pin and print the voltage. Open Tools > Plotter to see it as a chart.

A starter program from the MantisIDE Full IDE (Tools › Examples). Press Open in Full IDE to run it on your board, change it, and save it as your own.

# Read an analog pin and print the voltage. Open Tools > Plotter to see it as a chart.
from machine import ADC, Pin
import time

adc = ADC(Pin(34))  # Pico: ADC(26)

while True:
    raw = adc.read_u16()
    print("volts:", round(raw * 3.3 / 65535, 3))
    time.sleep(0.2)
Loading post…

Dialog