#!/bin/sh

echo 'My first hello world - by AVLdiy.cn / hahan'
echo 'This sh is how to call wbox function demo.'
echo 'Ma onPc universe0 channel1=180 will paly TF card 04.wav song.'
echo 'Ma onPc universe0 channel1=255 will exit this sh.'
echo 'Ma onPc universe0 channel1 changed and value=180 will replay song again.'
echo 'Ma onPc universe0 channel1 changed and value=100 will add volume.'

change=0
dmx=0

while true
do
	dmx=`readlight -p0 -c1`
	echo $dmx

	case $dmx in
		180) 	if [ $change == 0 ]
			then
				echo "dmx value=$dmx"
				echo "Now play /mnt/mmcblk0p1/04.wav song"
				change=1 
				callplay /mnt/mmcblk0p1/light/04.wav &	#do you want
			fi
		;;

		100) 	if [ $change == 0 ]
			then
				echo "dmx value=$dmx"
				echo "Now add volume"
				change=1 
				setkey -k103	#keyboard press UP key, add volume
			fi
		;;

		255)	break;
		;;

		*)	change=0		
		;;
	esac

	
	sleep 5
done

echo 'exit shell'

