Adafruit AHT10 Library
Public Member Functions | Protected Attributes | Friends | List of all members
Adafruit_AHTX0 Class Reference

Class that stores state and functions for interacting with the AHT10/AHT20 I2C Temperature/Humidity sensor. More...

#include <Adafruit_AHTX0.h>

Public Member Functions

 Adafruit_AHTX0 ()
 Instantiates a new AHTX0 class.
 
bool begin (TwoWire *wire=&Wire, int32_t sensor_id=0, uint8_t i2c_address=AHTX0_I2CADDR_DEFAULT)
 Sets up the hardware and initializes I2C. More...
 
bool getEvent (sensors_event_t *humidity, sensors_event_t *temp)
 Gets the humidity sensor and temperature values as sensor events. More...
 
uint8_t getStatus (void)
 Gets the status (first byte) from AHT10/AHT20. More...
 
Adafruit_Sensor * getTemperatureSensor (void)
 Gets the Adafruit_Sensor object for the AHTx0's humidity sensor. More...
 
Adafruit_Sensor * getHumiditySensor (void)
 Gets the Adafruit_Sensor object for the AHTx0's humidity sensor. More...
 

Protected Attributes

float _temperature
 Last reading's temperature (C)
 
float _humidity
 Last reading's humidity (percent)
 
uint16_t _sensorid_humidity
 ID number for humidity.
 
uint16_t _sensorid_temp
 ID number for temperature.
 
Adafruit_I2CDevice * i2c_dev = NULL
 Pointer to I2C bus interface.
 
Adafruit_AHTX0_Temptemp_sensor = NULL
 Temp sensor data object.
 
Adafruit_AHTX0_Humidityhumidity_sensor
 Humidity sensor data object. More...
 

Friends

class Adafruit_AHTX0_Temp
 
class Adafruit_AHTX0_Humidity
 

Detailed Description

Class that stores state and functions for interacting with the AHT10/AHT20 I2C Temperature/Humidity sensor.

Member Function Documentation

◆ begin()

bool Adafruit_AHTX0::begin ( TwoWire *  wire = &Wire,
int32_t  sensor_id = 0,
uint8_t  i2c_address = AHTX0_I2CADDR_DEFAULT 
)

Sets up the hardware and initializes I2C.

Parameters
wireThe Wire object to be used for I2C connections.
sensor_idThe unique ID to differentiate the sensors from others
i2c_addressThe I2C address used to communicate with the sensor
Returns
True if initialization was successful, otherwise false.

◆ getEvent()

bool Adafruit_AHTX0::getEvent ( sensors_event_t *  humidity,
sensors_event_t *  temp 
)

Gets the humidity sensor and temperature values as sensor events.

Parameters
humiditySensor event object that will be populated with humidity data
tempSensor event object that will be populated with temp data
Returns
true if the event data was read successfully

◆ getStatus()

uint8_t Adafruit_AHTX0::getStatus ( void  )

Gets the status (first byte) from AHT10/AHT20.

Returns
8 bits of status data, or 0xFF if failed

◆ getTemperatureSensor()

Adafruit_Sensor * Adafruit_AHTX0::getTemperatureSensor ( void  )

Gets the Adafruit_Sensor object for the AHTx0's humidity sensor.

Returns
Adafruit_Sensor*

◆ getHumiditySensor()

Adafruit_Sensor * Adafruit_AHTX0::getHumiditySensor ( void  )

Gets the Adafruit_Sensor object for the AHTx0's humidity sensor.

Returns
Adafruit_Sensor*

Friends And Related Function Documentation

◆ Adafruit_AHTX0_Temp

friend class Adafruit_AHTX0_Temp
friend

Gives access to private members to Temp data object

◆ Adafruit_AHTX0_Humidity

friend class Adafruit_AHTX0_Humidity
friend

Gives access to private members to Humidity data object

Member Data Documentation

◆ humidity_sensor

Adafruit_AHTX0_Humidity* Adafruit_AHTX0::humidity_sensor
protected
Initial value:
=
NULL

Humidity sensor data object.


The documentation for this class was generated from the following files: