Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions examples/automatic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from gpiozero import CPUTemperature
from fanshim import FanShim
from threading import Lock
import colorsys
Expand Down Expand Up @@ -47,12 +48,8 @@ def update_led_temperature(temp):


def get_cpu_temp():
t = psutil.sensors_temperatures()
for x in ['cpu-thermal', 'cpu_thermal']:
if x in t:
return t[x][0].current
print("Warning: Unable to get CPU temperature!")
return 0
cpu = CPUTemperature()
return cpu.temperature


def get_cpu_freq():
Expand Down
2 changes: 2 additions & 0 deletions library/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ ignore =
[pimoroni]
py3deps =
python3-rpi.gpio
python3-gpiozero
python3-setuptools
python3-dev
python3-psutil
py2deps =
python-rpi.gpio
python-gpiozero
python-setuptools
python-dev
python-psutil
Expand Down