Is there a little example of how to write and read a serial port in Java with Windows?
Port - The Serial port to use dataBits - The number of data bits per transfer. Valid values are between 5 and 8 bits. Parity - Select the type of parity checking to use. StopBits - The number of stop bits to use as defined by the enum StopBits. SerialPort public SerialPort (int baudRate, SerialPort.Port port, int dataBits, SerialPort.Parity parity). Open a serial port using Java Communications. case CommPortIdentifier.PORTSERIAL: thePort = thePortID.open('DarwinSys DataComm', TIMEOUTSECONDS. 1000); SerialPort myPort = (SerialPort. Related examples in the same category. Querying Available COM Ports: 2. Printing a File: 3.
Peter Mortensenclosed as not constructive by Matthew Farwell, Sai Kalyan Kumar Akshinthala, Nasreddine, Andrew Barber, BalusCNov 17 '11 at 23:26
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
3 Answers
Java Open A Serial Port
You have to import javax.comm.SerialPort
for this purpose to do, refer to Read from a Serial port to know more information.
Java Serial Port Programming Example
VladJava Serial Port Gui Example
VladI used RXTX library.
Example code can be found here: http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port
socha23socha23