I need to store data coming from Arduino
on Java
via serial communication only that the values sometimes not completely filled. I'm using the rxtx
library.
//trecho do código para leitura
int available = input.available();
byte chunk[] = new byte[available];
input.read(chunk, 0, available);
output.write(0);
output.flush();
String teste = new String(chunk);
System.out.println(teste);
close();//fecha comunicação serial
Do Arduino
send data so @678&
,
But sometimes Java
stores @6, 7, 8&, etc
or it will take only one piece.