DHT sensor library
Public Member Functions | List of all members
DHT Class Reference

Class that stores state and functions for DHT. More...

#include <DHT.h>

Public Member Functions

 DHT (uint8_t pin, uint8_t type, uint8_t count=6)
 Instantiates a new DHT class. More...
 
void begin (uint8_t usec=55)
 Setup sensor pins and set pull timings. More...
 
float readTemperature (bool S=false, bool force=false)
 Read temperature. More...
 
float convertCtoF (float)
 Converts Celcius to Fahrenheit. More...
 
float convertFtoC (float)
 Converts Fahrenheit to Celcius. More...
 
float computeHeatIndex (bool isFahrenheit=true)
 Compute Heat Index Simplified version that reads temp and humidity from sensor. More...
 
float computeHeatIndex (float temperature, float percentHumidity, bool isFahrenheit=true)
 Compute Heat Index Using both Rothfusz and Steadman's equations (http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml) More...
 
float readHumidity (bool force=false)
 Read Humidity. More...
 
bool read (bool force=false)
 Read value from sensor or return last one from less than two seconds. More...
 

Detailed Description

Class that stores state and functions for DHT.

Constructor & Destructor Documentation

◆ DHT()

DHT::DHT ( uint8_t  pin,
uint8_t  type,
uint8_t  count = 6 
)

Instantiates a new DHT class.

Parameters
pinpin number that sensor is connected
typetype of sensor
countnumber of sensors

Member Function Documentation

◆ begin()

void DHT::begin ( uint8_t  usec = 55)

Setup sensor pins and set pull timings.

Parameters
usecOptionally pass pull-up time (in microseconds) before DHT reading starts. Default is 55 (see function declaration in DHT.h).

◆ readTemperature()

float DHT::readTemperature ( bool  S = false,
bool  force = false 
)

Read temperature.

Parameters
SScale. Boolean value:
  • true = Fahrenheit
  • false = Celcius
forcetrue if in force mode
Returns
Temperature value in selected scale

◆ convertCtoF()

float DHT::convertCtoF ( float  c)

Converts Celcius to Fahrenheit.

Parameters
cvalue in Celcius
Returns
float value in Fahrenheit

◆ convertFtoC()

float DHT::convertFtoC ( float  f)

Converts Fahrenheit to Celcius.

Parameters
fvalue in Fahrenheit
Returns
float value in Celcius

◆ computeHeatIndex() [1/2]

float DHT::computeHeatIndex ( bool  isFahrenheit = true)

Compute Heat Index Simplified version that reads temp and humidity from sensor.

Parameters
isFahrenheittrue if fahrenheit, false if celcius (default true)
Returns
float heat index

◆ computeHeatIndex() [2/2]

float DHT::computeHeatIndex ( float  temperature,
float  percentHumidity,
bool  isFahrenheit = true 
)

Compute Heat Index Using both Rothfusz and Steadman's equations (http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml)

Parameters
temperaturetemperature in selected scale
percentHumidityhumidity in percent
isFahrenheittrue if fahrenheit, false if celcius
Returns
float heat index

◆ readHumidity()

float DHT::readHumidity ( bool  force = false)

Read Humidity.

Parameters
forceforce read mode
Returns
float value - humidity in percent

◆ read()

bool DHT::read ( bool  force = false)

Read value from sensor or return last one from less than two seconds.

Parameters
forcetrue if using force mode
Returns
float value

The documentation for this class was generated from the following files: