Class representing the Adafruit MCP3421 ADC breakout.
More...
#include <Adafruit_MCP3421.h>
Class representing the Adafruit MCP3421 ADC breakout.
◆ begin()
| boolean Adafruit_MCP3421::begin |
( |
uint8_t |
i2c_addr = 0x68, |
|
|
TwoWire * |
wire = &Wire |
|
) |
| |
Initialize the MCP3421 sensor.
- Parameters
-
| i2c_addr | The I2C address of the sensor. |
| wire | The I2C interface to use. |
- Returns
- true if initialization is successful, false otherwise.
◆ setGain()
| void Adafruit_MCP3421::setGain |
( |
mcp3421_gain |
gain | ) |
|
Set the gain of the MCP3421.
- Parameters
-
◆ getGain()
| mcp3421_gain Adafruit_MCP3421::getGain |
( |
| ) |
|
Get the current gain setting of the MCP3421.
- Returns
- mcp3421_gain The current gain setting.
◆ setResolution()
| void Adafruit_MCP3421::setResolution |
( |
mcp3421_resolution |
res | ) |
|
Set the resolution of the MCP3421.
- Parameters
-
| res | The resolution setting. |
◆ getResolution()
| mcp3421_resolution Adafruit_MCP3421::getResolution |
( |
| ) |
|
Get the current resolution setting of the MCP3421.
- Returns
- mcp3421_resolution The current resolution setting.
◆ setMode()
| void Adafruit_MCP3421::setMode |
( |
mcp3421_mode |
mode | ) |
|
Set the operational mode of the MCP3421.
- Parameters
-
| mode | The operational mode. |
◆ getMode()
| mcp3421_mode Adafruit_MCP3421::getMode |
( |
| ) |
|
Get the current operational mode of the MCP3421.
- Returns
- mcp3421_mode The current operational mode.
◆ isReady()
| bool Adafruit_MCP3421::isReady |
( |
| ) |
|
Check if the MCP3421 has completed a conversion, can be used in continuous or one-shot mode.
- Returns
- true if conversion is complete, false otherwise.
◆ startOneShotConversion()
| bool Adafruit_MCP3421::startOneShotConversion |
( |
| ) |
|
Start a one-shot conversion on the MCP3421.
- Returns
- true if the I2C write is successful, false otherwise.
◆ readADC()
| int32_t Adafruit_MCP3421::readADC |
( |
| ) |
|
Read the ADC value from MCP3421.
- Returns
- int32_t The ADC value as a differential reading.
The documentation for this class was generated from the following files: