diff --git a/Software/Board_Test.sh b/Software/Board_Test.sh new file mode 100755 index 0000000..d8f1f9b --- /dev/null +++ b/Software/Board_Test.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +Serial_Port=$1 +if [ -z "$Serial_Port" ] +then + echo "Usage : $0 Serial_Port" + echo " Serial_Port is the full path to the board serial port device, like '/dev/ttyUSB0'." + echo " Make sure your user is part of the 'dialout' or 'uucp' group to allow this script to call 'stty' command with no privilege." + exit 1 +fi + +echo "+------------------------+" +echo "| USB relays board tests |" +echo "+------------------------+" + +echo "Configuring serial port..." +stty -F $Serial_Port 9600 + +echo "Turning led off for 2 seconds..." +echo "#L0" > $Serial_Port +sleep 2 + +echo "Turning led on for 2 seconds..." +echo "#L1" > $Serial_Port +sleep 2 + +echo "Making led blink for 5 seconds..." +echo "#L2" > $Serial_Port +sleep 5 + +echo "Stopping led blinking..." +echo "#L1" > $Serial_Port +# Give some time to the board to process the command and send the answer +sleep 0.5 + +for i in $(seq 1 16) +do + Relay_ID=$(printf "%02d" $i) + + echo "Tuning relay $i on for 2 seconds..." + echo "#S${Relay_ID}1" > $Serial_Port + sleep 2 + + echo "Tuning relay $i off..." + echo "#S${Relay_ID}0" > $Serial_Port + # Give some time to the board to process the command and send the answer + sleep 0.5 +done + +echo "All tests terminated."