Created
February 1, 2017 18:13
-
-
Save LarsBergqvist/a11a1067433acf592b2f195c49f49d8f to your computer and use it in GitHub Desktop.
Print the CPU temperature on a Raspberry Pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from subprocess import check_output | |
from re import findall | |
def get_temp(): | |
temp = check_output(["vcgencmd","measure_temp"]).decode("UTF-8") | |
return(findall("\d+\.\d+",temp)[0]) | |
print(get_temp()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment