Softwarserial don't work with Arduino UNO

Hello everybody,
I have a problem with my Arduino bords. I’m using softwarserial.h library to send a data from Arduino 1 to Arduino 2
But here is the problem, when I use Arduino mega as transmitter and Arduino UNO as receiver it’s work, but when I reverse the role, don’t works, I mean when I use Arduino uno as transmitter and Arduino mega as receiver don’t work, but when I use both of card by Arduino uno it’s work, the same think for Arduino nano,
To understand this, we can say:

Transmitter receiver result

Arduino UNO Arduino UNO work

Arduino UNO Arduino Mega Don’t wok

Arduino Mega Arduino UNO work

I need to know why they don’t work
Here are my codes

// transmitter

#include <SoftwareSerial.h>

SoftwareSerial mySerial(6, 11); // RX, TX

void setup() {
Serial.begin(9600);
mySerial.begin(9600);  // put your setup code here, to run once:
}
void loop() {
  mySerial.println("hello");
  delay(2000); 
}
// receiver
#include <SoftwareSerial.h>

SoftwareSerial mySerial(6, 11); // RX, TX

void setup() {
Serial.begin(9600);
mySerial.begin(9600);  // put your setup code here, to run once:
}
void loop() {
if(mySerial.available()){
  char dt[6]="";
 mySerial.readBytesUntil('\n',dt,5);
  Serial.println(dt); 
}
}

thank you :slight_smile:

Bonjour,

Seules certaines pins peuvent être utilisées pour SoftwareSerial sur la mega.
Voir la doc

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Remarque: la mega a 4 liaisons série, il n'est pas nécessaire d'utiliser SoftwareSerial