Just a few questions while checking both DHT versions:Rob:- Has a delay of 20msec for both DHT11 and DHT22.- Uses a counter in the while to break out of the while in case the pin does not changeMark:- Has a delay of 18msec for the DHT11 and 800usec for the DHT22.- Uses an endless while loop, so if the pin does not change --> Arduino in endless loop!Further:- I am using multiple DHT22's on different pins. Which library would be most RAM efficient?- Is the 800usec the right delay for the DHT22? If so, it saves me 5*19msec = 75msec of doing nothing, which is a lot using NilRTOS/ChibiOS RTOSses...Please comment
800usec for a DHT22 is according to the datasheets I found. And it works.
My library won't hang. The endless loop you mention has a return statement which is called after 85 usec.Per DHT instance, you need 18 bytes of data, perhaps a little more overhead, I would need to measure to give a hard number. So no problem to run a lot of DHT sensors (tried two myself). The advantage of having an instance per sensor is that you can read out them in parallel. On the other hand, it would be straightforward to alter setup() to something like setup(pin, model) and then you could reuse the instance. But not sure if the effort is worth the 18*(sensor-1) bytes...
Hello Rob, I tried this library on Arduino Due and it seems since its SAM series processor the includes for AVR wont work (avr/io.h etc).Can you suggest changes to make this library compile and work on Arduino Due boards . Thanks for the help
#define TIMEOUT (F_CPU/1600)
I have some problems with the library.I have an arduino due and an am2301 sensor (DHT21).The temperature at the moment that I tested the sensor was more or less 22 degrees.I set up: #define TIMEOUT 52500 in dht.cppData showned in dht_test.ino is:Humidity 2.3 Temperature 0.9Any idea??Thanks!