Hello,
I am currently working on a project on Tinkercad, in particular, I'm trying to send data from one to the other. I have connected the two as you see in the screenshot down below:

The first Arduino (the one on the top) has the following code:
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 8);
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
lcd.begin(16, 2);
lcd.print("Hello world");
Serial.begin(9600);
mySerial.begin(9600);
}
void loop()
{
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
mySerial.println("Hello from Arduino A");
delay(50000);
}
While the second one (the one on the bottom left), has the following code:
#include <Keypad.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(13, 12);
const byte COLS = 4;
const byte ROWS = 4;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'},
};
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
String password = "A196*", input = "";
char customKey;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
}
void loop() {
char customKey = customKeypad.getKey();
if (customKey) {
input += customKey;
Serial.println(input);
}
if (mySerial.available()) { // Controlla se ci sono dati disponibili
String message = mySerial.readStringUntil('\n'); // Leggi i dati ricevuti fino a un newline
Serial.println("Received message: " + message); // Stampa i dati ricevuti sulla seriale del computer
}
}
Everything works fine, in fact when I run the code I receive in the second Arduino some text, but the problem is that it's not what the first one sent:
Message: Hello from Arduino A
I receive: Received message: ¤²ë2ɽµA V_åý
I really hope you can help me.
Thank you very much in advice