Embedded Freaks..

August 11, 2008

Writing to serial port (using Rxtx)

Filed under: java — Tags: , , — kunilkuda @ 7:57 am

Writing to serial port is easy once you’ve got the serial port’s outputstream. Just do something like this:

String serialMessage = "AT\r\n";
OutputStream outstream = serialPort.getOutputStream();

Refer to my previous post for opening and getting the output stream for the serial port.

Additional Notes

From wikibooks Serial Java, comes a good advice, do not use Reader/Writer for AT command, since Reader/Writer will translate the AT command into the Unicode (your code might work as it is, or might not work if you use different Unicode than latin/ISO-8859-1 as default Unicode in the system).

1 Comment »

  1. excellet

    Comment by rammohan reddy — June 15, 2012 @ 3:46 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: