I’ve got a quite weird behavior of DHT library.
I’ve got DHT22 sensor. If it’s signal cable is not connected, reading the sensor causes a problem: Arduino reboots or hangs in unpredictable places.
If I connect the signal cable again, the problem vanishes.
Is this normal behavior or some sort of bug? I think unsuccessful reading affects some part of Memory.
PS. The project is quite big and I can’t share the code here.
It happens that I found an evidence that dht object influences foreign memory. Look at this code:
DV("pClock->isInited 3", pClock->isInited); // prints 1
dht1.readHumidity();
DV("pClock->isInited 4", pClock->isInited); // print 0 !!!!
// nothing more can be called between these lines.
// DV is a macro which prints label and value.
// Both objects created before this.
DHT dht1(11, DHT22);
…
dht1.begin();
…
pClock = new ZhClock(); // uses RTC_DS1307
pClock->init(&rtc); // rtc is RTC_DS1307