This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

write to serial port ?  RSS feed

Markus Schmidt
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the wireless toolkit (sun) I can read the serial port using "...(StreamConnection)"comm:0;baudrate=4800",Connector.READ_WRITE)...".
I am not able to write to the serial port.

Here is the code snippet:
byte bytearrayin[] = new byte[300];
byte bytearrayout[] = new byte[3];
StreamConnection c = null;
InputStream is = null;
OutputStream os = null;

bytearrayout[0] = 125;
bytearrayout[1] = 0;
bytearrayout[2] = 38;

try {
c = (StreamConnection)"comm:0;baudrate=9600;stopbits=1",Connector.READ_WRITE);
os = c.openOutputStream();
is = c.openInputStream();;


} catch (Exception e){}
I placed the read,write and close commands in different orders...
Thank you for any help,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!