Create a Python script to monitor the CPU temperature of raspberry pi
"ORANGMILITER"
untuk melakukan pengecekan cukup mudah, kita hanya cukup memasang gpiozero.
sudo apt install python-gpiozero python3-gpiozero atau'
pip install gpiozero
untuk menjalankannya cukup dengan menuliskan kode berikut :
>>> from gpiozero import CPUTemperature
>>> cpu = CPUTemperature()
>>> cpu.temperature
52.078
sekarang kita akan membuat jadwal pengecekan suhu :
# pip install schedule
>>> from gpiozero import CPUTemperature
>>> import schedule
>>> import time
>>>
>>> def temp():
... cpu = CPUTemperature()
... print ("CPU TEMP : %s C" % cpu.temperature)
... schedule.every(1).minutes.do(temp) #Jadwal Ini Bro
... while True:
... schedule.run_pending()
... time.sleep(1)
>>>
CPU TEMP : 52.41 C
CPU TEMP : 52.43 C
Kontak : t.me/orangmiliter
grup : t.me/KaliLinuxID
sumber :
- https://gpiozero.readthedocs.io/en/stable/recipes.html#cpu-temperature-bar-graph
- https://github.com/dbader/schedule
sudo apt install python-gpiozero python3-gpiozero atau'
pip install gpiozero
untuk menjalankannya cukup dengan menuliskan kode berikut :
>>> from gpiozero import CPUTemperature
>>> cpu = CPUTemperature()
>>> cpu.temperature
52.078
sekarang kita akan membuat jadwal pengecekan suhu :
# pip install schedule
>>> from gpiozero import CPUTemperature
>>> import schedule
>>> import time
>>>
>>> def temp():
... cpu = CPUTemperature()
... print ("CPU TEMP : %s C" % cpu.temperature)
... schedule.every(1).minutes.do(temp) #Jadwal Ini Bro
... while True:
... schedule.run_pending()
... time.sleep(1)
>>>
CPU TEMP : 52.41 C
CPU TEMP : 52.43 C
Kontak : t.me/orangmiliter
grup : t.me/KaliLinuxID
sumber :
- https://gpiozero.readthedocs.io/en/stable/recipes.html#cpu-temperature-bar-graph
- https://github.com/dbader/schedule