[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

read and serial port



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello,

i created a bash-script to send something to serial port
(/dev/ttyACM0) and read the result.

Here my code:

- ---
DEV=/dev/ttyACM0

stty raw -F $DEV ispeed 38400 ospeed 38400 cread -cstopb -echo

echo "@00P0?" > $DEV

while read -r -t 1 LINE
do
	echo $LINE
done < $DEV

echo "Result: $LINE"
- ---

The command will be send out correctly to the serial port. In the
console i can see the correct incoming result (String), but my var
$LINE is empty and doesn`t catch it.

Any clue or hint for me why read does not catch the result?

Thanks for your help,

Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCgAGBQJTccOgAAoJEFF6fE6T32A8cgUH/3UHMLwzaG7tdaCM6otzFt/b
TiVraCsAUMChnBjHpSRg8qphk01NHb+u0QXjFO74WQgznylyFDW68sO5drk90sOl
jYy8tFkUn06JkVMuZbyfyGtrQA2kx5zz9sUBN07w9Gl+BzWL+h0Pp3hxfV7URzZF
thzSMLJ5OEogZhbCsIixnC+TzTBZtDAVIMpyRxzEHoM/qwt+g3JAzIJPVi6MiUGs
FxyDLU+gSI3AnKgiKQLoSP2cqK1/YBwczzsOjeQcW/1vcAiz45qImSyhj+uZujoK
3V4WAoxT5NNS0zdlzs1wO0+9mRcxd09JnsmPxcM9fjIPUPrVb/Z1RNF4GOUQ28M=
=pm9c
-----END PGP SIGNATURE-----


Reply to: