![python code for raspberry pi weather display python code for raspberry pi weather display](https://user-images.githubusercontent.com/18541752/64130413-0edf2300-cd90-11e9-9d7b-71b1a9527c6b.png)
Sudo python /usr/lib/cgi-bin/temp-monitor.py & You then have to change again /etc/rc.local and insert a line for the program to start when the Rpi is rebooted :
#PYTHON CODE FOR RASPBERRY PI WEATHER DISPLAY PASSWORD#
You need to register (it’s free) an account to upload the data.Īfter that you will have an ID and a password which you sould change in the cmd variable as shownĬmd = “curl “+”‘”+str((temp*1.8)+32)+”&humidity=”+str(round(humidity,2))+”&baromin=”+str((pressure/100)*0.0295299)+”&action=updateraw”+”‘” This website provides some really nice stats and graphs. The cmd variable is responsible for sending the data to using curl. Not importante stuff, but you cam always check them if you like A Raspberry Pi is a useful learning tool for those that want to learn about coding or robotics or computer hardware, but it can also be a source of endless. There is a few calculations inside these functions, but this is all according to the sensors datasheet. It is necessary for the following function read_humidity.
![python code for raspberry pi weather display python code for raspberry pi weather display](https://blog.seeedstudio.com/wp-content/uploads/2020/08/屏幕快照-2020-08-12-上午11.51.53.png)
Read_temperature is a function that will read the temperature of the HUT21D for compensation when calculating the relative humidity. The first part of the program shows the libraries needed.įollowing the program we have 2 functions that will read humidity. You should have python installed, if not, just follow