java 串口写入 注意

SerialPort port = new SerialPort(); port.enableReceiveTimeout(30); //要加上 否则串口回一直等待 字符而不返回 InputStream is = new SerialPort().getInputStream(); while (newData != -1) { try { newData =is.read(); } catch (IOException ex) { System.err.println(ex); return; } }

你可能感兴趣的:(java)