Communication between two Arduino Mega - Serial Communication

Hi, I am encountering a weird situation when making two Arduino Mega to communicate via UART.

// On my Mega 1
void setup()


void loop()

Using this coding, my Mega 2 receive ONLY "hi". But if I uncomment the second Serial3.begin(115200), then my Mega 2 receive BOTH "hi" and "mega".

This is weird. Why?

I've change a new Arduino Mega and no more having this problem.

Why would you use a second Serial3.begin() ?

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 communication between Arduinos

You can send data in a compatible format with code like this

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