Bananian

Control LED by CPU temperature :o)

4 2040
nebkas  
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

temperature

temperature

temperature.zip

361 Bytes, Downloads: 39

temperature.sh

great job!!

nebkas  
thx

My intention was to find something for controlling a fan with the pwm gpio. I think this could be a base for it.

AdamiX  
Hello,

do you have a newer script with a PWM fan support? Thanks!

You have to log in before you can reply Login | Sign Up

Points Rules