Reading/Writing Serial Port from Bash
The problem
Write and read from a serial port from Linux Bash.
The solution
- Initialize serial port
stty -F /dev/ttyUSB0 -speed 9600 cs8 -cstopb
- Prepare to Read
cat -v < /dev/ttyUSB0 &
- Write (send a command)
echo -en '\xAA\x04\xC2' > /dev/ttyUSB0
Written on August 15, 2018