Peguei o exemplo que comunicação com porta serial RXTX aqui do Site. A balança esta comunicando porem esta entrando do Evento SerialPortEvent.DATA_AVAILABLE porem o retorno do Peso esta tudo em Caracteres especiais.
Tentei fazer desta Forma
case SerialPortEvent.DATA_AVAILABLE:
while (novoDado != -1) {
try {
novoDado = entrada.read();
if (novoDado == -1) {
break;
}
if ('\r' == (char) novoDado) {
bufferLeitura.append('\n');
} else {
bufferLeitura.append((char) novoDado);
}
} catch (IOException ioe) {
System.out.println("Erro de leitura serial: " + ioe);
}
}
E desta Forma.
case SerialPortEvent.DATA_AVAILABLE:
byte[] readBuffer = new byte[1024];
try {
int numBytes = 0;
while (inputStream.available() > 0) {
numBytes = inputStream.read(readBuffer);
}
String result = new String(readBuffer);
result = result.substring(1, numBytes);
System.out.println("Read: "+result);
} catch (IOException e) {}
break;