35 #define DHT_DATA_BIT_COUNT 40 66 uint8_t
i = 0, j = 0, b = 0, data_valid = 0;
72 DigitalInOut DHT_io(
_pin);
84 (
_DHTtype == 22) ? wait_ms(18) : wait(1);
103 for (i = 0; i < 5; i++)
105 for (j = 0; j < 8; j++)
113 bit_value[i * 8 + j] = DHT_io;
121 for (i = 0; i < 5; i++)
124 for (j = 0; j < 8; j++)
126 if (bit_value[i * 8 + j] == 1)
137 if (DHT_data[4] == data_valid)
181 return celsius * 9 / 5 + 32;
186 return celsius + 273.15;
193 float A0 = 373.15 / (273.15 + celsius);
194 float SUM = -7.90298 * (A0 - 1);
195 SUM += 5.02808 * log10(A0);
196 SUM += -1.3816e-7 * (pow(10, (11.344 * (1 - 1 / A0))) - 1) ;
197 SUM += 8.1328e-3 * (pow(10, (-3.49149 * (A0 - 1))) - 1) ;
198 SUM += log10(1013.246);
199 float VP = pow(10, SUM - 3) * humidity;
200 float T = log(VP / 0.61078);
201 return (241.88 * T) / (17.558 - T);
211 float temp = (a * celsius) / (b + celsius) + log(humidity / 100);
212 float Td = (b * temp) / (a - temp);
float CalcdewPoint(float const celsius, float const humidity)
float ReadTemperature(eScale const Scale)
#define DHT_DATA_BIT_COUNT
float ConvertCelciustoKelvin(float const)
eError stall(DigitalInOut &io, int const level, int const max_time)
float CalcdewPointFast(float const celsius, float const humidity)
float ConvertCelciustoFarenheit(float const)
DHT(PinName pin, eType DHTtype)