Help with Serial Communication

I am trying to have a two way communication between Arduino Mega's. I am currently using the SCL and SDA terminals for a LCD display. I was doing research and found that the RX and TX could potentially work for my two way communication and I was wondering how to go about it. I want to send various functions, for example if an open command is given on one the same should be one the second, that is the same for a close command. Thanks for any assistance that could be given.

I was wondering how to go about it.

Exactly the same as if the thing on the other end of the serial port was a PC.

I want to send various functions

I suggest that you get over it, then. You can send data. Functions are executable code, created by the compiler and linker.

Connect Rx1 to Tx1, Tx1 to Rx1, Gnd to Gnd.
In both sketches, have
then send data back & forth.

Serial1.write ("0");


if (Serial1.available() >0){ // at least 1 byte was received
incoming1Byte =; // read it
switch (incoming1Byte){ // act on it
case '0':
case '1':
// etc

You may find some useful ideas in Serial Input Basics