nethoncho / Arduino-DHT22

Arduino library for the DHT22 humidity and temperature sensor
http://goo.gl/uy1fV
120 stars 123 forks source link

BUG : return DHT_ERROR_CHECKSUM when temperature is negative. #1

Open capswiz opened 12 years ago

capswiz commented 12 years ago

So I removed "currentTemperature &= 0x7FFF" line 208 and put "& 0x7FFF" in the expression line 209. Now it works with negative temperatures.

darcoto commented 10 years ago

Suggested fix (from pull request) is not accurate for me because the unary minus will be performed before the & The right code must be: _lastTemperature = -(currentTemperature & 0x7FFF); Now it work fine for my instance