We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba24aff commit 4d83dbbCopy full SHA for 4d83dbb
RpiInternalSensors.py
@@ -2,9 +2,13 @@
2
3
class RpiInternalSensors:
4
5
- def get_cpu_temp(self):
+ def get_cpu_temp(self, fahrenheit=False):
6
lines = subprocess.check_output(["vcgencmd", "measure_temp"])
7
- temp = self.parse_lines(lines)['temp'][:-2]
+ temp = float(self.parse_lines(lines)['temp'][:-2])
8
+
9
+ if fahrenheit:
10
+ temp = ((temp * 9.0)/5.0) + 32
11
12
return temp
13
14
def get_ram_split(self):
print_all_sensors.py
@@ -2,5 +2,6 @@
sen = RpiInternalSensors()
-print sen.get_cpu_temp()
+print sen.get_cpu_temp(), "'C"
+print sen.get_cpu_temp(fahrenheit=True), "'F"
print sen.get_ram_split()
0 commit comments