AnalogIn – read analog voltage


import analogio
from board import *

adc = analogio.AnalogIn(A1)
val = adc.value
class analogio.AnalogIn(pin)

Use the AnalogIn on the given pin. The reference voltage varies by platform so use reference_voltage to read the configured setting.

Parameters:pin (Pin) – the pin to read from

Turn off the AnalogIn and release the pin for other use.


No-op used by Context Managers.


Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.


The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)

Even if the underlying analog to digital converter (ADC) is lower resolution, the value is 16-bit.


The maximum voltage measurable (also known as the reference voltage) as a float in Volts.