Trying to get a GPIO board working, need to access it from script, here is what I am using:
stty -F /dev/ttyACM1 115200 raw -echo #CONFIGURE SERIAL PORT
exec 3</dev/ttyACM1 #REDIRECT SERIAL OUTPUT TO FD 3
cat <&3 > /tmp/ttyDump.dat & #REDIRECT SERIAL OUTPUT TO FILE
PID=$! #SAVE PID TO KILL CAT
echo "gpio readall" > /dev/ttyACM1 #SEND COMMAND STRING TO SERIAL PORT
sleep 5s #WAIT FOR RESPONSE
kill $PID #KILL CAT PROCESS
exec 3<&- #FREE FD 3
cat /tmp/ttyDump.dat #DUMP CAPTURED DATA
The board is working - I can access via screen, enter same command and get results back, so I know its my fractured script. What am I doing wrong?
Note - this script was copied from elsewhere here on stackexchange.