sending things over serial

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jada9596
Posts: 1
Joined: 15 Jan 2014 12:22

sending things over serial

#1 Post by jada9596 » 15 Jan 2014 12:38

I'm trying to communicate with an arduino over serial. I've used PuTTY just fine, but for my current project, it would be really useful to use a batch program. Naturally, I googled it and found out you can use the following:

echo a > COM3

to send 'a' to com 3. The issue is that this only works after already opening the PuTTY command line. Even if I just open it and close it again, it will work, but I need it to be functional without the use of PuTTY at all. Any suggestions?

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: sending things over serial

#2 Post by Squashman » 15 Jan 2014 20:11

You would probably be better off posting on an Arduino forum but I just did my usual Google Foo.
http://stackoverflow.com/questions/9247 ... or-arduino
http://stackoverflow.com/questions/1100 ... ot-working

Running it as a Powershell command looks like your best option but are you sure you are using the correct COM port?

Another article said that Arduino does not allow Carriage Return and Line Feeds to be sent to it. So that may cause some issues using cmd.exe. If that is the case then maybe you can do this trick.

Code: Select all

set /p "=a" >COM3 <nul

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: sending things over serial

#3 Post by Squashman » 15 Jan 2014 20:18

Although based on your example I am betting that you forgot to use the MODE command first.

Code: Select all

mode COM3 BAUD=9600 PARITY=n DATA=8
echo a > COM3

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: sending things over serial

#4 Post by penpen » 16 Jan 2014 12:26

As there may be problems in sending special data (for example a single '='-char) you may create a file and use copy, to communicate with the com port 3 instead of redirecting "echo" or "set/P" (assumed you wanted example.text to be send):

Code: Select all

copy /B "example.txt" COM3


penpen

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: sending things over serial

#5 Post by Samir » 18 Jan 2014 12:54

Your best bet may be to find an older DOS comm program like quicklink that had scripting capability.

carlsomo
Posts: 91
Joined: 02 Oct 2012 17:21

Re: sending things over serial

#6 Post by carlsomo » 20 Jan 2014 23:23

Real Terminal emulation software:

http://realterm.sourceforge.net/

Command line and script options are available. The version I use only runs on Win 32 bit but they may have updated the program since I downloaded it. I have serial devices attached to PC via serial to USB cables and this software works great capturing serial output and sending commands, handshakes, etc. Hope this helps. Carl

Post Reply