Skip to content

Instantly share code, notes, and snippets.

@AndrewRadev
Created December 22, 2011 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRadev/1510374 to your computer and use it in GitHub Desktop.
Save AndrewRadev/1510374 to your computer and use it in GitHub Desktop.
Simple shell script that checks the current cheerlights color
#! /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