I'm sending some ascii data over serial from a teensy LC and a java app using jssc on a linux pc.
Initially I had trouble that, for whatever reason, sometimes an entire line would not get outputted.
For instance. when
Serial.print("abcdefghijklmnopqrstuvwxyz);
Serial.println();
On java, I might get the whole line, but occasionally esp. with bluetooth, I would only get partial "abcdefghijklmno", and the next string would have the rest of it.
I accounted for that in the java app by calling serialPort.readString() until I detected a '\r' followed by a '\n'.
But now I notice that sometimes I get multiple lines when I call serialPort.readString()
Any tips on handling this? Would I better off by using Serial.print('\n'), rather than Serial.println()?
I can think of a couple of ways to handle this that gets a little involved, but I'm just wondering if there's a simpler method that I'm missing.
Thanks.
Initially I had trouble that, for whatever reason, sometimes an entire line would not get outputted.
For instance. when
Serial.print("abcdefghijklmnopqrstuvwxyz);
Serial.println();
On java, I might get the whole line, but occasionally esp. with bluetooth, I would only get partial "abcdefghijklmno", and the next string would have the rest of it.
I accounted for that in the java app by calling serialPort.readString() until I detected a '\r' followed by a '\n'.
But now I notice that sometimes I get multiple lines when I call serialPort.readString()
Any tips on handling this? Would I better off by using Serial.print('\n'), rather than Serial.println()?
I can think of a couple of ways to handle this that gets a little involved, but I'm just wondering if there's a simpler method that I'm missing.
Thanks.