So for a raspberry Pi 4 project I'm creating a site using the typical Apache server with a php file. I'd like my site to display the core temperature of the raspberry pi itself and I found some python code that achieves this from the article https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f:
import os
import time
def measure_temp():
temp = os.popen("vcgencmd measure_temp").readline()
return(temp.replace("temp=",""))
while true:
print(measure_temp())
time.sleep(1)
but for me, running the script displays nothing in the python terminal and hence adding this to the php file to be displayed on the site also produces nothing.
I'm also aware that you can do a basic command 'watch vcgencmd measure_temp', but I have no idea how I'd run the pi code on on a php file?
Similarly, I also purchased a DS18B20 temperature sensor and I would like to add that to the site! I understand how to set it all up, but I have no idea how I could go about displaying the information on a site.
I'm completely new to the Pi, PHP and websites in general as you can probably tell, so any form of help will be greatly appreciated!!
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire