java串口编程
String aa = "91H,03H,00H,00H,2AH";//把要发送的指令赋给aa
outputStream = serialPort.getOutputStream();
outputStream.write(aa.getBytes());//把指令发送出去
aa.getBytes 后变为 [B@1f78b68 了,
这只是部分代码,怎么样能让outputStream.write的参数是91H,03H,00H,00H,2AH ??
------解决方案--------------------
byte[] a =new byte[]{(byte)0x91H,(byte)0x03H,(byte)0x00H,(byte)0x00H,(byte)0x2AH}
outputStream.write(a);