Hello,
I have an extremely simple setup to communicate between two arduino megas using some max485's and the SoftwareSerial library (Necessary because in the program this is used in, I use multiple communication lines and use the hardware serial for debugging). I've had the exact same setup work in the past, but for some reason it no longer works. I have read similar threads and none had info that helped which I had not already tried.
The arduino on the receiving end immediately freezes when the code is uploaded, and the only thing that makes it to the serial monitor is "restarted". If I spam upload, maybe 1 out of 10 times it does actually receive the message, but will sometimes double or triple it and display "#: lollollol" for example. I have tried replacing the wires and even wiggling them around while its working incase that is the issue with no change. If I run the receiver before the transmitter, it does not become stuck, but displays "#" in the serial monitor with no signal getting through. This is the only consistent behavior I have found. I have also tried swapping roles of the arduinos with no change.
Wiring diagram, except with a common ground, RO pins go to pin 10 on the arduinos, and DI pins to go pin 11 on the arduinos. The only pins used are 5v, GND, 10 and 11:

Receiving arduino code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
String signal;
int i = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("restarted");
}
void loop() {
// put your main code here, to run repeatedly:
signal = mySerial.readStringUntil('\n');
signal.trim();
i++;
Serial.print(i);
Serial.println(": " + signal);
}
Sending arduino code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("restarted");
}
void loop() {
// put your main code here, to run repeatedly:
mySerial.println("lol");
Serial.println("lol");
}
