我想向串口写入一个字符串,但串口写入方法只允许写入字节数组......所以我怎样才能将整个字符串发送到一个端口......这是我的代码......
serialPort.setSerialPortParams(300,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
OutputStream mOutputToPort = serialPort.getOutputStream();
String mValue = "ABCDEFG";
System.out.println("beginning to Write . \r\n");
mOutputToPort.write(mValue.getBytes());
System.out.println("AT Command Written to Port. \r\n");
mOutputToPort.flush();
我不想一个一个地发送它..我想要一个完整的... thnxx提前