3 # include the Onion sh lib
4 . /usr/lib/onion/lib.sh
9 echo " Set colors on Omega Expansion Dock LED"
13 echo " Displays color of hex value on the Exp Dock LED"
16 echo " Displays this prompt"
21 ########################
22 ##### Main Program #####
26 [ "$1" == "-help" ] ||
28 [ "$1" == "--help" ] ||
38 #split into color components
39 hex=`echo $hex | sed -e 's/0x//' `
40 rHex=`echo $hex | sed -e 's/....$//' `
41 gHex=`echo $hex | sed -e 's/^..//' -e 's/..$//' `
42 bHex=`echo $hex | sed -e 's/^....//' `
44 rDuty=$(ExpLedHexToDuty $rHex)
45 gDuty=$(ExpLedHexToDuty $gHex)
46 bDuty=$(ExpLedHexToDuty $bHex)
48 echo "Setting LEDs to: $hex"
49 echo "Duty: $rDuty $gDuty $bDuty"
52 if [ $rHex != "00" ]; then
53 fast-gpio pwm 17 200 $rDuty;
58 if [ $gHex != "00" ]; then
59 fast-gpio pwm 16 200 $gDuty;
64 if [ $bHex != "00" ]; then
65 fast-gpio pwm 15 200 $bDuty;