Simple Temp monitor example using LCDLabel

Post Reply
User avatar
BruceSteers
Posts: 210
Joined: Thursday 23rd July 2020 5:20pm

Simple Temp monitor example using LCDLabel

Post by BruceSteers » Thursday 17th September 2020 8:09pm

This is a simple text based temperature display using LCDLabel
Made as an example it is simple and has many descriptive comments.

Gets temperature in one of 2 ways,
Either runs a command and uses it's direct output or
loads a Raspberry_PI style temp file that stores the temperature as a simple number being the temperature X 1000

For raspberry pi simply give it the file path...
'/sys/class/thermal/thermal_zone0/temp'

or it can use a shell command like sensors (from package lm-sensors) with grep and awk to get the temperature text.
Use 'sudo apt-get install lm-sensors' or use your package manager to install.

Command Example...

Code: Select all

sensors|grep 'Core 0'|awk '{print $3}'
The above command runs 'sensors', uses grep to find the line with 'Core 0' in it that for me looks like this...
Core 0: +45.0°C (high = +82.0°C, crit = +100.0°C)

and then uses awk to get the 3rd bit of text '+45.0°C' (space separation makes 'Core 0:' 2 words)

Written in Gambas basic
Code has FULL comments explaining everything.
Has a minimum-requirement-installer to install required gambas components.

Other features...
Change background / text and highlight colour
Set Time delay between checks.
Show/Hide Window border/titlebar
Drag-Move window

Bruce
Attachments
MyTemp.png
MyTemp.png (76.51 KiB) Viewed 366 times
MyTemp.zip
(32.96 KiB) Downloaded 30 times
If at first you don't succeed , try it differently.

Post Reply