I've installed java JDK 1.7
Code: Select all
java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)Code: Select all
public static void main(String[] args) {
SerialPort serialPort = new SerialPort("/dev/ttyUSB0");
try {
System.out.println("Port opened: " + serialPort.openPort());
System.out.println("Params setted: " + serialPort.setParams(9600, 8, 1, 0));
System.out.println("Request for temperature sent " + serialPort.writeBytes("\rT\r".getBytes()));
System.out.println("temperature is : "+new String(serialPort.readBytes(10)));
System.out.println("Port closed: " + serialPort.closePort());
}
catch (SerialPortException ex){
System.out.println(ex);
}
}Minicom testing was always successful. Testing of the same code on a pc running Debian was without this problem.
What went wrong?