CircuitPython base class driver for ADS1015/1115 ADCs.
-
class adafruit_ads1x15.ads1x15.ADS1x15(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, address: int = 72)[source]
Base functionality for ADS1x15 analog to digital converters.
- Parameters:
i2c (I2C) – The I2C bus the device is connected to.
gain (float) – The ADC gain.
data_rate (int) – The data rate for ADC conversion in samples per second.
Default value depends on the device.
mode (Mode) – The conversion mode, defaults to Mode.SINGLE
.
address (int) – The I2C address of the device.
-
property bits: int
The ADC bit resolution.
-
property data_rate: int
The data rate for ADC conversion in samples per second.
-
property gain: float
The ADC gain.
-
property gains: List[float]
Possible gain settings.
-
get_last_result(fast: bool = False) → int[source]
Read the last conversion result when in continuous conversion mode.
Will return a signed integer value. If fast is True, the register
pointer is not updated as part of the read. This reduces I2C traffic
and increases possible read rate.
-
property mode: int
The ADC conversion mode.
-
property rate_config: Dict[int, int]
Rate configuration masks.
-
property rates: List[int]
Possible data rate settings.
-
read(pin: Pin, is_differential: bool = False) → int[source]
I2C Interface for ADS1x15-based ADCs reads.
- Parameters:
-
-
class adafruit_ads1x15.ads1x15.Mode[source]
An enum-like class representing possible ADC operating modes.
-
CONTINUOUS = 0
Continuous Mode
-
SINGLE = 256
Single-Shot Mode
CircuitPython driver for ADS1015 ADCs.
-
class adafruit_ads1x15.ads1015.ADS1015(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, address: int = 72)[source]
Class for the ADS1015 12 bit ADC.
-
property bits: Literal[12]
The ADC bit resolution.
-
property rate_config: Dict[int, int]
Rate configuration masks.
-
property rates: List[int]
Possible data rate settings.
-
adafruit_ads1x15.ads1015.P0 = 0
Analog Pin 0
-
adafruit_ads1x15.ads1015.P1 = 1
Analog Pin 1
-
adafruit_ads1x15.ads1015.P2 = 2
Analog Pin 2
-
adafruit_ads1x15.ads1015.P3 = 3
Analog Pin 3
CircuitPython driver for 1115 ADCs.
-
class adafruit_ads1x15.ads1115.ADS1115(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, address: int = 72)[source]
Class for the ADS1115 16 bit ADC.
-
property bits: Literal[16]
The ADC bit resolution.
-
property rate_config: Dict[int, int]
Rate configuration masks.
-
property rates: List[int]
Possible data rate settings.
-
adafruit_ads1x15.ads1115.P0 = 0
Analog Pin 0
-
adafruit_ads1x15.ads1115.P1 = 1
Analog Pin 1
-
adafruit_ads1x15.ads1115.P2 = 2
Analog Pin 2
-
adafruit_ads1x15.ads1115.P3 = 3
Analog Pin 3
AnalogIn for single-ended and
differential ADC readings.
-
class adafruit_ads1x15.analog_in.AnalogIn(ads: ADS1x15, positive_pin: int, negative_pin: int | None = None)[source]
AnalogIn Mock Implementation for ADC Reads.
- Parameters:
ads (ADS1x15) – The ads object.
positive_pin (int) – Required pin for single-ended.
negative_pin (int) – Optional pin for differential reads.
-
property value: int
Returns the value of an ADC pin as an integer.
-
property voltage: float
Returns the voltage from the ADC pin as a floating point value.