Project with unidirecional communication between 2 Arduinos

Hello everybody I am new in the group and with little knowledge of Arduino. I’m trying to make a project about unidirectional communication between two Arduino ( one Tx and one Rx) , the Tx Arduino sends the “Hello World” and the Rx Arduino receives that sentence. For that I have to use IR communication ( Transmitting IR LED and receiving IR photo sensor) and to avoid errors or loss of data communication I will have to implement some kind of error detecting and error correction (maybe interleaving FEC?), could you give me some tips for an easy way to do this?
I send my small and simple code, I can already send and receive the sentence.
Thanks in advance!!

Transmitter.ino

#include <SoftwareSerial.h>

#define rxPin 3
#define txPin 4

SoftwareSerial XSERIAL = SoftwareSerial(rxPin, txPin);

void setup()
{
XSERIAL.begin(9600);
}

void loop()
{
XSERIAL.println(“Hello World”);
delay(10);
}

Receiver.ino

#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3

SoftwareSerial XSERIAL = SoftwareSerial(rxPin, txPin, false);

void setup()
{
XSERIAL.begin(9600);

Serial.begin(9600);

Serial.println(“Start Listening…”);
}

void loop()
{

if (XSERIAL.available())
{
incomingByte = (char)XSERIAL.read()

Serial.print("I received: ");
Serial.println(incomingByte);

}
}

I will have to implement some kind of error detecting

Maybe send a checksum and reject the message if it is wrong at the receiving end.

and error correction

Not so easy, but a Google search should turn something up, including algorithms, which you can incorporate into the code.

Have a look at the third example in Serial Input Basics. Surrounding your data with start- and end-markers may give sufficient reliability. You could also include a byte which denotes the length of the message as an additional simple check.

It is also easy to use XOR to create a single check digit - XOR all the bytes in the message and include the result as an additional byte.

I know nothing about error correction. Is it really necessary?

I assume you are sending the data with a "proper" IR carrier frequency (38kHz?). If not you may be interested in this Thread.

...R

Thanks a lot guys, I already send and receive "well"... now I'm trying to implement the Error correction but it's tough , if checksum fails I'm trying to print the message as the receiver receives the message or wait for the next message and compare...

I'm trying to print the message as the receiver receives the message or wait for the next message and compare...

It would be simpler if your message had a marker for the beginning of the message.