Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Fix bug in DHT_ESP32 example
Browse files Browse the repository at this point in the history
Added comment about potential compatibility with DHT33 and DHT44 sensors

Signed-off-by: beegee-tokyo <bernd@giesecke.tk>
  • Loading branch information
beegee-tokyo committed Jul 6, 2018
1 parent bbf83ba commit 5d4c5db
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions DHTesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
2018-01-03: Added retry in case the reading from the sensor fails with a timeout.
2018-01-08: Added ESP8266 (and probably AVR) compatibility.
2018-03-11: Updated DHT example
2018-06-19: Updated DHT example to distinguish between ESP8266 examples and ESP32 examples
2018-07-06: Fixed bug in ESP32 example
******************************************************************/

#include "DHTesp.h"
Expand Down
3 changes: 3 additions & 0 deletions DHTesp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
2018-01-03: Added function getTempAndHumidity which returns temperature and humidity in one call.
2018-01-03: Added retry in case the reading from the sensor fails with a timeout.
2018-01-08: Added ESP8266 (and probably AVR) compatibility.
2018-03-11: Updated DHT example
2018-06-19: Updated DHT example to distinguish between ESP8266 examples and ESP32 examples
2018-07-06: Fixed bug in ESP32 example
******************************************************************/

#ifndef dhtesp_h
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Why did I clone this library instead of forking the original repo and push the c
When I searched through Github for DHT libraries, I found a lot of them, some of them offers additional functions, some of them only basic temperature and humidity values. I wanted to combine all interesting functions into one library. In addition, none of the DHT libraries I found were written to work without errors on the ESP32. For ESP32 (a multi core/ multi processing SOC) task switching must be disabled while reading data from the sensor.
Another problem I found is that many of the available libraries use the same naming (dht.h, dht.cpp), which easily leads to conflicts if different libraries are used for different platforms.

_**According to users, the library works as well with DHT33 and DHT44 sensors. But as I do not own these sensors, I cannot test and confirm it. However, if you want to use this sensors, you can do so by using `setup(pin, DHTesp::DHT22)` and it should work.
Please give me feedback in the issues if you successfull use these sensors.
Thank you**_

The library is tested as well on ESP8266 and should work on AVR boards as well.

Changes to the original library:
Expand All @@ -25,6 +29,7 @@ Changes to the original library:
- 2018-01-08: Added ESP8266 (and probably AVR) compatibility.
- 2018-03-11: Updated DHT example
- 2018-06-19: Updated DHT example to distinguish between ESP8266 examples and ESP32 examples
- 2018-07-06: Fixed bug in ESP32 example
Features
--------
- Support for DHT11 and DHT22, AM2302, RHT03
Expand Down
2 changes: 2 additions & 0 deletions examples/DHT_ESP32/DHT_ESP32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ void setup()
Serial.println();
Serial.println("DHT ESP32 example with tasks");
initTemp();
// Signal end of setup() to tasks
tasksEnabled = true;
}

void loop() {
Expand Down
2 changes: 2 additions & 0 deletions examples/DHT_ESP8266/DHT_ESP8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ void setup()
Serial.begin(115200);
Serial.println();
Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)\tHeatIndex (C)\t(F)");
String thisBoard= ARDUINO_BOARD;
Serial.println(thisBoard);

// Autodetect is not working reliable, don't use the following line
// dht.setup(17);
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "DHT sensor library for ESPx",
"keywords": "onewire, 1-wire, bus, sensor, temperature",
"description": "Arduino ESP library for DHT11, DHT22, etc Temp & Humidity Sensors. Last changes: Updated examples.",
"description": "Arduino ESP library for DHT11, DHT22, etc Temp & Humidity Sensors. Last changes: Fix bug in examples.",
"repository":
{
"type": "git",
"url": "https://github.com/beegee-tokyo/DHTesp.git"
},
"version": "1.0.7",
"version": "1.0.8",
"frameworks": "arduino",
"platforms": "*",
"license": "GPL-3.0-only",
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=DHT sensor library for ESPx
version=1.0.7
version=1.0.8
author=beegee_tokyo
maintainer=beegee_tokyo <beegee@giesecke.tk>
sentence=Arduino ESP library for DHT11, DHT22, etc Temp & Humidity Sensors
paragraph=Optimized libray to match ESP32 requirements. Last changes: Updated examples.
paragraph=Optimized libray to match ESP32 requirements. Last changes: Fix bug in examples.
category=Sensors
url=http://desire.giesecke.tk/index.php/2018/01/30/esp32-dht11/
architectures=esp8266,esp32,arduino-esp32
Expand Down

0 comments on commit 5d4c5db

Please sign in to comment.