1
0
Fork 0
led-annunciator/annunciatorServer/annunciatorServer.sh
2019-09-01 00:52:57 +02:00

23 lines
339 B
Bash
Executable file

#!/bin/bash
port=/dev/ttyUSB0
cmdfile=~/annunciatorServer.txt
## Setup serial port
stty -F $port ispeed 9600 ospeed 9600 -ignpar cs8 -cstopb -hupcl
## Setup files
touch $cmdfile
## Monitor file for new commands
while true
do
incmd=$(head -c 1 $cmdfile)
if [ _$incmd != _ ]
then
echo $incmd > $port
> $cmdfile
fi
sleep 1
done