I am working on a Raspberry Pi DHT22 Humidity monitor. This is my code: pastebin.com/vHGCgjd2 And when I run this code, this is the output:
Humidity is Critical! (Too high) Current humidity: 45.2 %
And I have no idea why it says that "Humidity is CRITICAL!", because the humidity is 45.2% and 45.2 is not higher than 75%. Please help.
You create string hum
and then you compare string with integer (65 and 75) so you get wrong result. You have to compare number t
(or maybe h
) with integer (65 and 75).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.