DHT_nonblocking icon indicating copy to clipboard operation
DHT_nonblocking copied to clipboard

Decimal value on DHT11

Open fplanque opened this issue 4 years ago • 3 comments

Hi!

It seems that the DHT11 does actually report 1 decimal for temperature (eg: 19.9 °C) as shown here: https://forum.arduino.cc/index.php?topic=656964.0

Is there any way to obtain the decimal value with this library? (I always get a rounded number, eg: 19.0 or 20.0)

Thank you.

fplanque avatar Jan 06 '21 02:01 fplanque

Same issue but I fixed it by looking at the latest Adafruit code. In read_temperature( ) change the relevant case to

  case DHT_TYPE_11:
    to_return = data[2];
    if (data[3] & 0x80) to_return = -1. - to_return;
    to_return += (data[3] & 0x0f) * 0.1;
    break;

BTW, it works with esp32 and that should be added to library.properties.

alwynallan avatar Jan 06 '21 14:01 alwynallan

Same issue but I fixed it ...

BTW, it works with esp32 and that should be added to library.properties.

Could you please make a pull request so I can update the library?

Thanks!

olewolf avatar Jan 06 '21 14:01 olewolf

My git skills are limited, but I think I did it right.

There's another change in the Pull Request - increased COOLDOWN_TIME - that might cause problems elsewhere.

Thanks for maintaining this. Adafruit should adopt it.

A. Peter Allan

On Wed, Jan 6, 2021 at 9:45 AM Ole Wolf [email protected] wrote:

Same issue but I fixed it ...

BTW, it works with esp32 and that should be added to library.properties.

Could you please make a pull request so I can update the library?

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/olewolf/DHT_nonblocking/issues/7#issuecomment-755339869, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNKNTHGZLHA5KUMPL437M3SYRZQZANCNFSM4VWZTRNA .

alwynallan avatar Jan 06 '21 16:01 alwynallan