Bananian
Control LED by CPU temperature :o)
4
2534
View: 2534|Reply: 4
|
[Bananian]
Control LED by CPU temperature :o)
[Copy link]
|
|
Hi folks!
Today I wrote a simple script for showing the CPU temperature by using the green LED
0-39° = LED OFF
40-49°C = LED heartbeat
over 50°C = LED on
You need the "lm-sensors" package(apt-get install lm-sensors)
greetz
Nebkas
#!/bin/zsh
while
do
temp=$( sensors | grep temp | cut -c16-17 )
clear
if [ $temp -le 39 ]
then
echo -e "Aktuelle Temperatur: " "\e[32m$temp" "\e[0m°C"
echo none > /sys/class/leds/green\:ph24\:led1/trigger
elif [ $temp -le 49 ]
then
echo "Aktuelle Temperatur: " "\e[33m$temp" "\e[0m°C"
echo heartbeat > /sys/class/leds/green\:ph24\:led1/trigger
else
echo "Aktuelle Temperatur: " "\e[31m$temp" "\e[0m°C"
echo default-on > /sys/class/leds/green\:ph24\:led1/trigger
fi
sleep 1
done
|
|
|
|
|
|
|
|
Cool! Thx!  |
|
|
|
|
|
|
|
thx 
My intention was to find something for controlling a fan with the pwm gpio. I think this could be a base for it. |
|
|
|
|
|
|
|
Hello,
do you have a newer script with a PWM fan support? Thanks! |
|
|
|
|
|
|