Page 1 of 1

Simple Temp monitor example using LCDLabel

Posted: Thursday 17th September 2020 8:09pm
by BruceSteers
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...

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