Table of Contents

Class AhtBase

Namespace
Iot.Device.Ahtxx
Assembly
Iot.Device.Ahtxx.dll

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 I2cDevice

Reference to the initialized I2C interface device.

initCommand byte

Type 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

int

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.