Table of Contents

Class DhtBase

Namespace
Iot.Device.DHTxx.Esp32
Assembly
Iot.Device.Dhtxx.Esp32.dll

Temperature and Humidity Sensor DHTxx

[Interface("Temperature and Humidity Sensor DHTxx")]
public abstract class DhtBase
Inheritance
DhtBase
Derived

Constructors

DhtBase(I2cDevice)

Create a DHT sensor through I2C (Only DHT12)

public DhtBase(I2cDevice i2cDevice)

Parameters

i2cDevice I2cDevice

The I2C device used for communication.

DhtBase(int, int, PinNumberingScheme, GpioController?, bool)

Create a DHT sensor

public DhtBase(int pinEcho, int pinTrigger, PinNumberingScheme pinNumberingScheme = PinNumberingScheme.Logical, GpioController? gpioController = null, bool shouldDispose = true)

Parameters

pinEcho int

The pin number which is used as echo (GPIO number)

pinTrigger int

The pin number which is used as trigger (GPIO number)

pinNumberingScheme PinNumberingScheme

The GPIO pin numbering scheme

gpioController GpioController

GpioController related with operations on pins

shouldDispose bool

true to dispose the GpioController

Fields

_controller

GpioController related with the _pin.

protected GpioController? _controller

Field Value

GpioController

_i2cDevice

I2C device used to communicate with the device

protected I2cDevice? _i2cDevice

Field Value

I2cDevice

_pin

GPIO pin

protected readonly int _pin

Field Value

int

_readBuff

Read buffer

protected byte[] _readBuff

Field Value

byte[]

_rxChannel

The receiver channel used to receive the signals.

protected ReceiverChannel? _rxChannel

Field Value

ReceiverChannel

_shouldDispose

True to dispose the Gpio Controller

protected readonly bool _shouldDispose

Field Value

bool

Properties

Humidity

Get the last read of relative humidity in percentage

[Telemetry]
public virtual RelativeHumidity Humidity { get; }

Property Value

RelativeHumidity

Remarks

If last read was not successful, it returns

default(RelativeHumidity)

IsLastReadSuccessful

How last read went, true for success, false for failure

public bool IsLastReadSuccessful { get; }

Property Value

bool

Temperature

Get the last read temperature

[Telemetry]
public virtual Temperature Temperature { get; }

Property Value

Temperature

Remarks

If last read was not successful, it returns

default(Temperature)

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()