DHT

Class to read data from DHT11 humidity and temperature sensor.

Public Types

Type

Name

enum

eError { DHT11 = 11, SEN11301P = 11, RHT01 = 11, DHT22 = 22, AM2302 = 22, SEN51035P = 22, RHT02 = 22, RHT03 = 22, ERROR_NONE = 0, BUS_BUSY =1, ERROR_NOT_PRESENT =2, ERROR_ACK_TOO_LONG =3, ERROR_SYNC_TIMEOUT = 4, ERROR_DATA_TIMEOUT =5, ERROR_CHECKSUM = 6, ERROR_NO_PATIENCE =7 }

enum

eError { DHT11 = 11, SEN11301P = 11, RHT01 = 11, DHT22 = 22, AM2302 = 22, SEN51035P = 22, RHT02 = 22, RHT03 = 22, ERROR_NONE = 0, BUS_BUSY =1, ERROR_NOT_PRESENT =2, ERROR_ACK_TOO_LONG =3, ERROR_SYNC_TIMEOUT = 4, ERROR_DATA_TIMEOUT =5, ERROR_CHECKSUM = 6, ERROR_NO_PATIENCE =7 }

enum

eScale { CELCIUS =0, FARENHEIT =1, KELVIN =2 }

Public Functions

Type

Name

DHT (PinName pin, int DHTtype)

~DHT ()

int

readData (void)

float

float

ReadTemperature (eScale Scale)

float

CalcdewPoint (float celsius, float humidity)

float

CalcdewPointFast (float celsius, float humidity)

Public Types Documentation

enum eError

enum DHT::eError {
    DHT11 = 11,
    SEN11301P = 11,
    RHT01 = 11,
    DHT22 = 22,
    AM2302 = 22,
    SEN51035P = 22,
    RHT02 = 22,
    RHT03 = 22,
    ERROR_NONE = 0,
    BUS_BUSY =1,
    ERROR_NOT_PRESENT =2,
    ERROR_ACK_TOO_LONG =3,
    ERROR_SYNC_TIMEOUT = 4,
    ERROR_DATA_TIMEOUT =5,
    ERROR_CHECKSUM = 6,
    ERROR_NO_PATIENCE =7,
};

enum eError

enum DHT::eError {
    DHT11 = 11,
    SEN11301P = 11,
    RHT01 = 11,
    DHT22 = 22,
    AM2302 = 22,
    SEN51035P = 22,
    RHT02 = 22,
    RHT03 = 22,
    ERROR_NONE = 0,
    BUS_BUSY =1,
    ERROR_NOT_PRESENT =2,
    ERROR_ACK_TOO_LONG =3,
    ERROR_SYNC_TIMEOUT = 4,
    ERROR_DATA_TIMEOUT =5,
    ERROR_CHECKSUM = 6,
    ERROR_NO_PATIENCE =7,
};

enum eScale

enum DHT::eScale {
    CELCIUS =0,
    FARENHEIT =1,
    KELVIN =2,
};

Public Functions Documentation

function DHT

DHT::DHT (
    PinName pin,
    int DHTtype
)

DHT constructor

Parameters:

  • pin data pin of sensor

  • DHTtype type of sensor

function ~DHT

DHT::~DHT ()

function readData

int DHT::readData (
    void 
)

read the data from sensor

Returns:

eError or 0 in case of no error

function ReadHumidity

float DHT::ReadHumidity (
    void 
)

read last humidity, readData has to be called to update the value

Returns:

humidity in %

float DHT::ReadTemperature (
    eScale Scale
)

read last temperature, readData has to be called to update the value

Parameters:

  • Scale select the scale (CELCIUS, FARENHEIT or KELVIN)

Returns:

temperature in selected scale

function CalcdewPoint

float DHT::CalcdewPoint (
    float celsius,
    float humidity
)

float DHT::CalcdewPointFast (
    float celsius,
    float humidity
)

The documentation for this class was generated from the following file: D:/w/hw-libs/\_libs\_/libraries/DHT.h

Last updated