how to read data frome serialport using jssc in java?
问题 I used jssc library to read and write data from serial port. package serial; import jssc.*; public class Serial { public static void main(String[] args) { String[] portNames = null; portNames = SerialPortList.getPortNames(); for (String string : portNames) { System.out.println(string); } if (portNames.length == 0) { System.out.println("There are no serial-ports"); } else { SerialPort serialPort = new SerialPort("com2"); try { serialPort.openPort(); serialPort.setParams(SerialPort.BAUDRATE