analogio — Analog hardware supportΒΆ

The analogio module contains classes to provide access to analog IO typically implemented with digital-to-analog (DAC) and analog-to-digital (ADC) converters.


All classes change hardware state and should be deinitialized when they are no longer needed if the program continues after use. To do so, either call deinit() or use a context manager. See Lifetime and ContextManagers for more info.

For example:

import analogio
from board import *

pin = analogio.AnalogIn(A0)

This example will initialize the the device, read value and then deinit() the hardware. The last step is optional because CircuitPython will do it automatically after the program finishes.