Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
DHT Class Reference

Public Member Functions

 DHT (uint8_t pin, uint8_t type=DHT_AUTO, uint16_t minIntervalRead=READ_INTERVAL_DONT_CARE)
 
void begin ()
 
float readTemperature (bool bFarenheit=false)
 
float readHumidity ()
 
bool readTempAndHumidity (TempAndHumidity &destReading, bool bFarenheit=false)
 
ComfortProfile getComfortProfile ()
 
void setComfortProfile (ComfortProfile &c)
 
bool isTooHot (float temp=LAST_VALUE, float humidity=LAST_VALUE)
 
bool isTooHumid (float temp=LAST_VALUE, float humidity=LAST_VALUE)
 
bool isTooCold (float temp=LAST_VALUE, float humidity=LAST_VALUE)
 
bool isTooDry (float temp=LAST_VALUE, float humidity=LAST_VALUE)
 
float getHeatIndex (float tempCelsius=LAST_VALUE, float percentHumidity=LAST_VALUE, bool bFarenheit=false)
 
double getDewPoint (uint8_t algType=DEW_ACCURATE_FAST, float tempCelsius=LAST_VALUE, float percentHumidity=LAST_VALUE, bool bFarenheit=false)
 
float getComfortRatio (ComfortState &destComfStatus, float temp=LAST_VALUE, float percentHumidity=LAST_VALUE)
 
ErrorDHT getLastError ()
 

Static Public Member Functions

static float convertCtoF (float c)
 
static float convertFtoC (float f)
 

Constructor & Destructor Documentation

DHT::DHT ( uint8_t  pin,
uint8_t  type = DHT_AUTO,
uint16_t  minIntervalRead = READ_INTERVAL_DONT_CARE 
)
inline

Constructor.

Parameters
pin- the GPIO [in number the sensor is hooked up to
type- the sensor type
minIntervalRead- The minimum time between reads in ms

Member Function Documentation

void DHT::begin ( )

Must be called once at startup

float DHT::getComfortRatio ( ComfortState &  destComfStatus,
float  temp = LAST_VALUE,
float  percentHumidity = LAST_VALUE 
)

Get the heuristic COMFORT RATIO (0=unconfortable..100=confortable) based on current comfort profile.

Parameters
tempCelsius- temp in *C. Default uses the last temp reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
percentHumidity- humidity 0..100. Default uses the last humid reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
destComfStatus- will receive a comfort classification
double DHT::getDewPoint ( uint8_t  algType = DEW_ACCURATE_FAST,
float  tempCelsius = LAST_VALUE,
float  percentHumidity = LAST_VALUE,
bool  bFarenheit = false 
)

Get the calculated DEW POINT

Parameters
tempCelsius- temp in *C. Default uses the last temp reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
percentHumidity- humidity 0..100. Default uses the last humid reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
algType- Algorithm type to use. See DHT.c for details
float DHT::getHeatIndex ( float  tempCelsius = LAST_VALUE,
float  percentHumidity = LAST_VALUE,
bool  bFarenheit = false 
)

Get the calculated HEAT INDEX

Parameters
tempCelsius- temp in *C. Default uses the last temp reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
percentHumidity- humidity 0..100. Default uses the last humid reading. If the reading is old, a read() is triggered This can be disabled with the NO_AUTOREFRESH switch
bFarenheit- true if a conversion to Farenheit is desired
ErrorDHT DHT::getLastError ( )
inline

Gets the last occurred error.

float DHT::readHumidity ( )

Read humidity. Compatible with Adafruit's lib

bool DHT::readTempAndHumidity ( TempAndHumidity destReading,
bool  bFarenheit = false 
)

Read both temperature and humidity.

Parameters
destReading- will hold the temp and humidity readings
bFarenheit- true if a conversion to Farenheit is desired
float DHT::readTemperature ( bool  bFarenheit = false)

Read temperature. Compatible with Adafruit's lib(only for DHT_RUNTIME)

Parameters
bFarenheit- true if a conversion to Farenheit is desired