Java and serial io
I'm attempting to use Java to send and receive data to/from a serial device. I've got an example from the rxtx library's website: rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port. Problem is, I'm not really sure how to use it. I've never had the need to communicate with an external Java program like this. When I compile and run the example, it works just fine. It allows you to enter data into the text line, and it sends it out the serial port that was opened in the example code.
But what I need to do is send the example program data from another program, and have it send it out the serial port. It doesn't need to return data received on the serial port to the main program.
So I can create a new instance of the TwoWaySerialComm class with
but I'm not sure how to write to that instance's OutputStream (declared in SerialWriter class).
If anyone's familiar with Java, I'd appreciate some insight. Thanks!
But what I need to do is send the example program data from another program, and have it send it out the serial port. It doesn't need to return data received on the serial port to the main program.
So I can create a new instance of the TwoWaySerialComm class with
TwoWaySerialComm twoWaySerialComm = new TwoWaySerialComm();
but I'm not sure how to write to that instance's OutputStream (declared in SerialWriter class).
If anyone's familiar with Java, I'd appreciate some insight. Thanks!
Comments
Here's more info on interprocess communications: en.wikipedia.org/wiki/Inter-process_communication
I'm not a Java expert, but you should have no problem finding suitable Java classes to get something going.