I want to send a command to Arduino to trigger data aquisition and read the results (two values). A first test with cu works as expected (see first image). Building a shell script was not successful. Using stty to set the baud rate was not accepted. stty /dev/ttyMCC -a shows a baud rate of 38400. I think this is wrong. Default should be 115200. The cooked option was not accepted, too. Furthermore calling read the script hangs (see second image). Do you have any hint what's wrong here? Code: #!/bin/bash set -ex #stty -F /dev/ttyMCC 115200 cooked while true; do echo "AAA" > /dev/ttyMCC read -r ID < /dev/ttyMCC echo $ID done
The following script worked on a UDOO Quad. The Arduino was connected via ttymxc3. For UDOO NEO the program hangs. stty is commented because it fails too. Code: #!/bin/bash #Port settings #stty -F /dev/ttyMCC raw speed 115200 while : do echo 1 > /dev/ttyMCC read -r CMD < /dev/ttyMCC echo $CMD sleep 1 done