Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Created February 1, 2017 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LarsBergqvist/a11a1067433acf592b2f195c49f49d8f to your computer and use it in GitHub Desktop.
Save LarsBergqvist/a11a1067433acf592b2f195c49f49d8f to your computer and use it in GitHub Desktop.
Print the CPU temperature on a Raspberry Pi
#!/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