Add test scripts

This commit is contained in:
Markus Koch 2018-01-13 12:37:08 +01:00
parent b4dbad09e9
commit 6fea4cdb18
4 changed files with 54 additions and 0 deletions

18
scripts/chartest.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
source common.sh
echo -e "\r\nT\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B" > $hcs
echo -e "C\x00\x01\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x01\x00\x80\n\n\n" > /dev/ttyACM0
echo -e "C\x02\x04\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x03\x08\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x04\x10\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x05\x20\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x06\x40\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x07\x80\x00\n\n\n" > /dev/ttyACM0
echo -e "C\x08\x00\x01\n\n\n" > /dev/ttyACM0
echo -e "C\x09\x00\x02\n\n\n" > /dev/ttyACM0
echo -e "C\x0a\x00\x04\n\n\n" > /dev/ttyACM0
echo -e "C\x0b\x00\x08\n\n\n" > /dev/ttyACM0

9
scripts/clock.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
source common.sh
while [ 1 ]; do
date +"t%H : %M : %S" > $hcs;
sleep 0.5;
date +"t%H %M %S" > $hcs;
sleep 0.5;
done

2
scripts/common.sh Executable file
View File

@ -0,0 +1,2 @@
export hcs=/dev/ttyACM0
stty -F $hcs nl1

25
scripts/say.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
source common.sh
echo "t" > $hcs
echo -n "s" > $hcs
text=`echo "$1" | tr '\n' '\r' | sed "s/\r/ -- /g"`
text="-- $text "
echo "$text"
for (( i=0; i<${#text}; i++ )); do
c="${text:$i:1}"
chr=`LC_CTYPE=C printf '%d' "'$c"`
if [ "$chr" -gt "31" ]; then
echo -n "$c" > $hcs
echo -n "$c"
sleep 0.1
else
echo -n "#"
echo -n "$c" > $hcs
fi;
done
echo "$c" > $hcs
echo "$c"