Characteristic Locus
Inheritance System.Object ObservableBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> SensorBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> SamplingSensorBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> ByteCommsSensorBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> > DhtBase > Dht10 > Dht12
Implements ISamplingSensor<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> IDisposable ITemperatureSensor IHumiditySensor
Inherited Members ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Peripheral ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.ReadBuffer ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.WriteBuffer ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Init(Int32, Int32) ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Dispose(Boolean) ByteCommsSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Dispose() SamplingSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.StartUpdating(Nullable<TimeSpan>) SamplingSensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.StopUpdating() SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Updated SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.samplingLock SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.SamplingTokenSource SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Conditions SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.IsSampling SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.UpdateInterval SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.ReadSensor() SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.RaiseEventsAndNotify(IChangeResult<>) SensorBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.Read() ObservableBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.observers ObservableBase<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>.NotifyObservers(IChangeResult<>) Meadow.Foundation.ObservableBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>>.CreateObserver(Action<>, System.Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Atmospheric
Assembly Dhtxx.dll

Syntax

public abstract class DhtBase : ByteCommsSensorBase<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, ISamplingSensor<(Units.Temperature? Temperature, RelativeHumidity? Humidity)>, IDisposable, ITemperatureSensor, IHumiditySensor

Constructors

DhtBase(II2cBus, Byte)

Create a DHT sensor through I2C (Only DHT12)

Declaration
public DhtBase(II2cBus i2cBus, byte address = null)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus connected to the sensor

System.Byte address

The I2C address

Properties

Humidity

The relative humidity

Declaration
public RelativeHumidity? Humidity { get; }

Property Value

Type Description
System.Nullable<RelativeHumidity>

Temperature

The temperature

Declaration
public Units.Temperature? Temperature { get; }

Property Value

Type Description
System.Nullable<Units.Temperature>

WasLastReadSuccessful

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

Declaration
public bool WasLastReadSuccessful { get; }

Property Value

Type Description
System.Boolean

Methods

RaiseEventsAndNotify(IChangeResult<(Nullable<Units.Temperature> Temperature, Nullable<RelativeHumidity> Humidity)>)

Raise events for subcribers and notify of value changes

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Units.Temperature? Temperature, RelativeHumidity? Humidity)> changeResult)

Parameters

Type Name Description
IChangeResult<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>> changeResult

The updated sensor data

ReadSensor()

Reads data from the sensor

Declaration
protected override Task<(Units.Temperature? Temperature, RelativeHumidity? Humidity)> ReadSensor()

Returns

Type Description
Task<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>>

The latest sensor reading

Overrides

Meadow.Foundation.SensorBase<System.ValueTuple<System.Nullable<Units.Temperature>, System.Nullable<RelativeHumidity>>>.ReadSensor()

Events

HumidityUpdated

Raised when the humidity value changes

Declaration
public event EventHandler<IChangeResult<RelativeHumidity>> HumidityUpdated

Event Type

Type Description
EventHandler<IChangeResult<RelativeHumidity>>

TemperatureUpdated

Raised when the temperature value changes

Declaration
public event EventHandler<IChangeResult<Units.Temperature>> TemperatureUpdated

Event Type

Type Description
EventHandler<IChangeResult<Units.Temperature>>