The color doesn’t show up on the temperature bar as shown on pg. 173 on the “MicroPython ESP32 and ESP8266.” Color does show up for the humidity reading but does not show up on the temperature bar. Humidity bar is just white. I tried changing the code around with no success. How can I get color to show up on the temperature bar?
Hi.
That’s very difficult to know why that is happening. Are you getting any error?
Is the temperature reading (the number) showing up properly?
Also, what browser are you using to visualize the web server?
Not getting any errors that I know of and the temperature reading shows up some what accurately as 24* but no colored bar. I’ve tried it on IE, Chrome, Edge, and Safari and they all show the same. The humidity shows up with the bar (blue) and number, 52%.
Hi again.
I’ve tested the code again using an ESP32 and a DHT22 temperature sensor and everything is working fine in all different browsers.
Did you copy the code from GitHub? Sometimes copying from the ebook can cause indentation problems.
boot.py : https://github.com/RuiSantosdotme/ESP-MicroPython/blob/master/code/WiFi/Web_Server_DHT/boot.py
main.py: https://github.com/RuiSantosdotme/ESP-MicroPython/blob/master/code/WiFi/Web_Server_DHT/main.py
Based on that information it seems that the code is working but it either misses something while copying or typing the code or it can be a browser issue.
After double-checking all the code can you check in different browsers including smartphone?
Regards,
Sara
Sara,
I’ve checked everything as close as possible and the only differences are:
In the boot.py, I’ve changed lines 32 and 33. I commented line 32 with a # and deleted the # in line 33 because I’m using a Sunfounder DHT11.
And in lines 13, 15, and 16 in main.py I’ve commented line 13 and uncommented lines 15 and 16. Even when doing this I still get a reading in Centigrade but no bar. No Fahrenheit reading.
Hi.
I’ve tested again. This time with the DHT11 and I finally found out the error. It was our mistake in the code.
Sorry for taking so long to understand what was going on.
Basically, the DHT11 returns an int number while the DHT22 returns a float. So, our verification in line 10 was causing the issue.
We’ve corrected the code. You can find the latest version of the code on our github page:
https://github.com/RuiSantosdotme/ESP-MicroPython/blob/master/code/WiFi/Web_Server_DHT/main.py
The eBook will be updated on the next release, which will be next week.
Let me know if it is working for you.
Regards,
Sara
Sara,
Everything now works perfectly. Red bar is available and it reads in degrees Fahrenheit.
Thank you sooooo much for your help and developing such excellent tutorials.
Do you remember the reference you give out in one of threads to refresh the browser so that it doesn’t have to be done manual each time to get a current reading of temperature and humidity?
Again thank you for your help, you’re the best.
Gayland
That’s great! Thank you for supporting our work!
I think this is the thread you’re looking for:
How to change code to continually update Temperature and Humidity ?
Regards,
Sara