Hey, i am trying to send a string from one Arduino Mega to another Arduino Mega.
The connected Pins:
Pin 19 RX1 to pin 18TX1
Pin18TX1 to Pin 19 RX1
The code from the sender:
char mystr[3] = "Hello"; //String data
void setup() {
// Begin the Serial at 9600 Baud
Serial1.begin(9600);
}
void loop() {
Serial1.write(mystr,5); //Write the serial data
delay(1000);
}
The code from the receiver:
char mystr[5]; //Initialized variable to store recieved data
void setup() {
// Begin the Serial at 9600 Baud
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
Serial1.readBytes(mystr,5); //Read the serial data and store in var
delay(1000);
}
My receiver doesn't display the string from the Sender Arduino.
Do you guys see where the problem could be?