Class AhtBase
Base class for common functions of the AHT10/15 and AHT20 sensors.
[Interface("AHTxx temperature and humidity sensor")]
public abstract class AhtBase
- Inheritance
-
AhtBase
- Derived
Constructors
AhtBase(I2cDevice, byte)
Initializes a new instance of the AhtBase class for a sensor connected through I2C interface.
public AhtBase(I2cDevice i2cDevice, byte initCommand)
Parameters
i2cDevice
I2cDeviceReference to the initialized I2C interface device.
initCommand
byteType specific command for device initialization.
Fields
DefaultI2cAddress
Address of AHT10/15/20 device (0x38). This address is fix and cannot be changed. This implies that only one device can be attached to a single I2C bus at a time.
public const int DefaultI2cAddress = 56
Field Value
Methods
Dispose()
Defines a method to release allocated resources.
public void Dispose()
GetHumidity()
Gets the current relative humidity reading from the sensor. Reading the humidity takes between 10 ms and 80 ms.
[Telemetry("Humidity")]
public RelativeHumidity GetHumidity()
Returns
- RelativeHumidity
Relative humidity reading.
GetTemperature()
Gets the current temperature reading from the sensor. Reading the temperature takes between 10 ms and 80 ms.
[Telemetry("Temperature")]
public Temperature GetTemperature()
Returns
- Temperature
Temperature reading.