MCP3421

CircuitPython driver for the MCP3421 analog to digital converter

  • Author(s): Liz Clark

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_mcp3421.mcp3421.MCP3421(i2c, address=0x68, gain=None, resolution=None, continuous_mode=True)

Adafruit MCP3421 ADC driver

Initialization over I2C

Parameters:
  • address (int) – I2C address (default 0x68)

  • gain (int) – Select 1X, 2X, 4X or 8X gain (defaults to 1X)

  • resolution (int) – Select 12, 14, 16 or 18 bit resolution (defaults to 14-bit)

  • continuous_mode (bool) – Select continuous sampling or one shot sampling

property continuous_mode: bool

Current mode setting from the device

Return type:

bool

property gain: int

The current gain setting from the device, translated to user-friendly value

Return type:

int

read() int

ADC value

Returns:

ADC value

Return type:

int

property resolution: int

The current resolution setting from the device, translated to user-friendly value

Return type:

int

AnalogIn

AnalogIn for ADC readings.

  • Author(s): Liz Clark

class adafruit_mcp3421.analog_in.AnalogIn(adc: MCP3421)

AnalogIn Mock Implementation for ADC Reads.

Parameters:

adc (MCP3421) – The ADC object.

property value: int

Returns the value of an ADC pin as an integer