diff --git a/scripts/chartest.sh b/scripts/chartest.sh new file mode 100755 index 0000000..211db1e --- /dev/null +++ b/scripts/chartest.sh @@ -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 + diff --git a/scripts/clock.sh b/scripts/clock.sh new file mode 100755 index 0000000..378d3f3 --- /dev/null +++ b/scripts/clock.sh @@ -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 diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100755 index 0000000..3403e05 --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,2 @@ +export hcs=/dev/ttyACM0 +stty -F $hcs nl1 diff --git a/scripts/say.sh b/scripts/say.sh new file mode 100755 index 0000000..7701d13 --- /dev/null +++ b/scripts/say.sh @@ -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"