If you want to round the value to one decimal place you can add the line: cpu_temp = round(cpu_temp, 1) Simply import the library at the top of your script: import gpiozero as gzĪnd then read the temperature into a variable: cpu_temp = gz.CPUTemperature().temperature It’s fairly easy to read the Pi CPU temperature in Python using the Gpiozero library. You can change the values at which the warning colours are triggered. Right click on the Temperature in the top panel.You can change the thresholds and the colours used by: I used Spacers with a size of 10 to provide a sensible gap between the temperature reading and the surrounding panel items. Use the “Preferences” button to set the size of the spacer.Use the “Up” or “Down” buttons to position the spacer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |