2024-06-18 18:36:45 +03:00
2024-05-30 09:38:50 +03:00
2024-05-30 09:38:50 +03:00
2024-05-30 09:38:50 +03:00
2024-05-30 09:38:50 +03:00
2024-06-18 18:36:45 +03:00
2024-05-30 09:38:50 +03:00
2024-06-18 18:36:45 +03:00

ESP32 ESP-IDF and ESP8266 RTOS SDK component for DHT11/DHT22(AM2302) humidity & temperature sensor

Tested on

  1. ESP8266 RTOS_SDK v3.4
  2. ESP32 ESP-IDF v5.2

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)
{
	esp_log_level_set("zh_dht", ESP_LOG_NONE);
	zh_dht_handle_t dht_handle = zh_dht_init(ZH_DHT22, GPIO_NUM_5);
	float humidity = 0.0;
	float temperature = 0.0;
	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.
Readme 61 KiB
Version 2.0.0 Latest
2024-06-23 11:22:00 +03:00
Languages
C 99.3%
CMake 0.7%