diff options
author | Patrick Simianer <p@simianer.de> | 2014-08-10 11:19:38 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-08-10 11:19:38 +0100 |
commit | 5869505d64c04c536bdcd71a197ade918c36bf1c (patch) | |
tree | 6af5232a9f2e058f15230a370a960f89871a2b74 /blink |
init
Diffstat (limited to 'blink')
-rwxr-xr-x | blink | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -0,0 +1,43 @@ +#!/bin/sh +#_______________________________________________ +# blink.sh - ThinkBlink making ThinkLight blink +# author: Pawel Kazimierowicz www.PiKeyPL.com +#_______________________________________________ +# use: sh blink.sh [how many flashes] [how long flashes] +# eg. sh blink.sh 3 1 - three flashes for one second +# eg. sh blink.sh 2 5 - two flashes for five seconds +# +# http://pikeypl.com/index.php?show=code&menu=software&language=bash&code=blink.sh + + ile=$1; # ile mrugniec, parametr skryptu + i=1; # licznik do petli + +read d < /sys/class/leds/tpacpi\:\:thinklight/brightness #load state of ThinkLight +# when state = 0 - OFF, 255 - ON +# echo $d # print state of ThinkLight - for diagnostic. + +case "$d" in +# if ThinkLight if OFF: ON->OFF + "0") + while [ $i -le $ile ]; do + echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness ; + sleep $2; + echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness; + sleep $2; + i=$((i+1)); + + done;; + +# if ThinkLight is ON: OFF->ON +"255") + while [ $i -le $ile ]; do + echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness; + sleep $2; + echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness; + sleep $2; + i=$((i+1)); + done +esac + +# EOF ThinkBlink by Pawel Kazimierowicz + |