2.4gHz to 2.4gHz to Serial to Java

Hello, i have Uno listening for a message from Nano (basic integer 1001) after a basic keypress at Nano. Java on Uno side is listening serial for the same 1001 message (from Uno), and while Arduino IDE sees it as 1001, Java sees it as
10
01

100
1

etc.

We did change serial rate from 9600 to 57600 and it did help abit, but we still recieve wrong numbers sometimes.

Do you guys have any idea on what is the reason for this?

upd. yes, it goes in a separate lines (thats why numbers are wierd), but only in java, not in IDE
upd2. @115200 still about 8% of mistakes

Cut 2.4 gHz part, even if i'm just sending
Serial.println(1001);
on any message recieved, i still have the same problem

Is the Java code waiting for a newline character from the Uno? Or does it print a line when it thinks it has all the characters in the rx buffer?

edit: Wait for the newline character from the Uno before printing a newline with the Java script.

SurferTim:
Is the Java code waiting for a newline character from the Uno? Or does it print a line when it thinks it has all the characters in the rx buffer?

Its a jSSC library, we are not quite sure, but seems like its a second scenario of your message

Part of our code

if(event.isRXCHAR() && event.getEventValue() > 0){
try {
data = serialPort.readString(event.getEventValue());
}
catch{}
}

I'll bet it is your Java code that is causing the extra newline. The IDE serial monitor doesn't insert that extra newline.

SurferTim:
I'll bet it is your Java code that is causing the extra newline. The IDE serial monitor doesn't insert that extra newline.

But not all the time and not in a same place?

It clearly does break packets

494848491310

494848
491310

49
4848491310

and so on, the question is why IDE does not show any separate messages, while Java does.

The IDE waits for a newline character before printing on another line. It is obvious that your Java code doesn't. I can't tell for sure because my crystal ball is in the shop for repairs.

Yep, it does not. Working on it now. Thanx!

And now we have another one. This time, if we run more than 1 arduino/nrf/button set, we recieve the same message of whoever was first. Means, if we press button 1, and then press 2 or 3, we still recieve 1 in java, while its all good in IDE (1 2 3).

Upd. Events are different. Any kepress is a different event for Java, but the message is always the same as the first one

Will start a new thread in proper section of forum.