DHT 11 can report decimals?
-
I'm running several sketches. DHT22 reports just fine values like xx.xx
But DHT11 reports 0 decimals. So it is always like xx.00
Is that standart for dht11?
-
According to the data sheet, the accuracy of DHT11 is ±2℃. So reporting with decimals doesn't make sense. If the sensor is reporting 22 degrees the temperature might be anywhere between 20 and 24.
The accuracy of the DHT22 (again, from datasheet) is ±0.2C. So for the DHT22 it makes sense to report one decimal, but be aware that if the sensor reports 22.4 degrees the real temperature can be anywhere between 22.2 and 22.6.
See also http://forum.mysensors.org/topic/2686/improve-ds18b20-resolution
-
@moskovskiy82 if it's allways reporting x.0 than you store the result of the reading in a double of long. If you want to get rid of the decimals. You only have to cast the value to an int. This will truncate the value.
long x = 2.3;
Serial.println( (int)x );
will result in 2