Class DhtBase
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
I2cDeviceThe I2C device used for communication.
DhtBase(int, PinNumberingScheme, GpioController?, bool)
Create a DHT sensor
public DhtBase(int pin, PinNumberingScheme pinNumberingScheme = PinNumberingScheme.Logical, GpioController? gpioController = null, bool shouldDispose = true)
Parameters
pin
intThe pin number (GPIO number)
pinNumberingScheme
PinNumberingSchemeThe GPIO pin numbering scheme
gpioController
GpioControllerGpioController related with operations on pins
shouldDispose
boolTrue to dispose the Gpio Controller
Fields
_controller
GpioController related with the _pin.
protected GpioController? _controller
Field Value
_i2cDevice
I2C device used to communicate with the device
protected I2cDevice? _i2cDevice
Field Value
_pin
GPIO pin
protected readonly int _pin
Field Value
_readBuff
Read buffer
protected byte[] _readBuff
Field Value
- byte[]
_shouldDispose
True to dispose the Gpio Controller
protected readonly bool _shouldDispose
Field Value
Properties
Humidity
Get the last read of relative humidity in percentage
[Telemetry]
public virtual RelativeHumidity Humidity { get; }
Property Value
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
Temperature
Get the last read temperature
[Telemetry]
public virtual Temperature Temperature { get; }
Property Value
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()