• Post Reply Bookmark Topic Watch Topic
  • New Topic

write to serial port ?

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) Connector.open("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) Connector.open("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,
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!