Uno 2 uno serial comms...i only want to print new data

Hi guys…

My project involves sending a string of sensor values from one UNO to a second UNO. I currently have them communicating but when a new string is recieved the recieving UNO prints all of the previous strings as well as the new one.

I just want serial to show the latest string…do i need to clear the serial before printing and if so how???

Thanks

do i need to clear the serial before printing

No.

You DO need to post your codes. In code tags.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

…R