Created
December 22, 2011 13:55
-
-
Save AndrewRadev/1510374 to your computer and use it in GitHub Desktop.
Simple shell script that checks the current cheerlights color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
current_color='' | |
last_color='' | |
while :; | |
do | |
current_color=`curl -s 'http://api.thingspeak.com/channels/1417/field/1/last.txt'` | |
if [ "$current_color" != "$last_color" ] | |
then | |
last_color=$current_color | |
case $current_color in | |
'red' ) echo 'r' ;; #FF0000 | |
'green' ) echo 'g' ;; #008000 | |
'blue' ) echo 'b' ;; #0000FF | |
'cyan' ) echo 'c' ;; #00FFFF | |
'white' ) echo 'w' ;; #FFFFFF | |
'warmwhite' ) echo 'x' ;; #FDF5E6 | |
'purple' ) echo 'p' ;; #800080 | |
'magenta' ) echo 'm' ;; #FF00FF | |
'yellow' ) echo 'y' ;; #FFFF00 | |
'orange' ) echo 'o' ;; #FFA500 | |
esac | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment