Com port don't work in java
Posted
by
?????? ?????
on Stack Overflow
See other posts from Stack Overflow
or by ?????? ?????
Published on 2012-06-29T15:13:08Z
Indexed on
2012/06/29
15:15 UTC
Read the original article
Hit count: 289
java
Does't work with java... don't sent message to my microchip. please help
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("COM1");
try {
serialPort.openPort();
serialPort.setParams(9600, 8, 1, 0);
serialPort.setParams(SerialPort.BAUDRATE_9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.writeBytes("Test");
readBytes(), ???? ?? ??????? ??????
byte[] buffer = serialPort.readBytes(10);
//????????? ????
serialPort.closePort();
}
catch (SerialPortException ex) {
System.out.println(ex);
}
}
}
byte[] Write "[@B********"
Star is a random number.
© Stack Overflow or respective owner