I am trying to communicate with an electronics device with a serial connection, and I have two different USB to serial adaptors. If I plug either in to my Puppy 511 machine, it shows up as ttyUSB0, so that seems promising.
I thought I would just use the command line, and I think I know how to set the baud rate (stty -F /dev/ttyUSB0 ispeed 2400) and how to log the response into a file (cat /dev/ttyUSB0 > /root/my-documents/log_file.txt) (by cribbing from http://www.futuretimes.webfreehosting.n ... meter.html).
However what I have no idea about is how to send anything out, e.g. the commands that I need to send to my electronics device, so it then replies with the data that I can log.
Any help gratefully received.
How to talk to serial device via command line?
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
-
- Posts: 107
- Joined: Mon 05 Jan 2009, 17:35
Serial communication
You can send something (ABC) to the device with the following command.
More interactive would be the use of a terminal program like minicom.
Code: Select all
echo "ABC" > /dev/ttyUSB0
-
- Posts: 195
- Joined: Sat 21 Jan 2006, 05:35
- Location: Bedfordshire, UK
-
- Posts: 107
- Joined: Mon 05 Jan 2009, 17:35
Serial communication
You are right to try from the command line first to see if the communication with your device works fine. I only have the experience with some of these USB-To-Serial adapters under Windows and my experience is that not all of them work with all devices. The best way is still a good old COM port, but they are getting more difficult to find.