AnalogOut – output analog voltage

The AnalogOut is used to output analog values (a specific voltage).

Example usage:

import analogio
from microcontroller import pin

dac = analogio.AnalogOut(pin.PA02)          # output on pin PA02
dac.value = 32768                           # makes PA02 1.65V
class analogio.AnalogOut(pin)

Use the AnalogOut on the given pin.

Parameters:pin (Pin) – the pin to output to

Turn off the AnalogOut 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). (write-only)

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