ESP32 ESP-IDF and ESP8266 RTOS SDK component for DHT11/DHT22(AM2302) humidity & temperature sensor
Tested on
- ESP8266 RTOS_SDK v3.4
- ESP32 ESP-IDF v5.2
Function description
Using
In an existing project, run the following command to install the component:
cd ../your_project/components
git clone https://github.com/aZholtikov/zh_dht.git
In the application, add the component:
#include "zh_dht.h"
Example
Reading the sensor:
#include "zh_dht.h"
void app_main(void)
{
zh_dht_handle_t dht_handle = zh_dht_init(ZH_DHT22, GPIO_NUM_5);
float humidity;
float temperature;
for (;;)
{
zh_dht_read(&dht_handle, &humidity, &temperature);
printf("Humidity %0.2f\n", humidity);
printf("Temperature %0.2f\n", temperature);
vTaskDelay(5000 / portTICK_PERIOD_MS);
}
}
Any feedback will be gladly accepted.
Description
ESP32 ESP-IDF and ESP8266 RTOS SDK component for DHT11/DHT22/AM2302/AM2320 humidity & temperature sensor.
Version 2.0.0
Latest
Languages
C
99.3%
CMake
0.7%