-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Software] Added a simple Linux shell script testing some of the boar…
…d features.
- Loading branch information
1 parent
c4e9fd0
commit 29df569
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." |