Hello everybody,
I'm having problem communicating with the MEGA 2560 through Serial 1,2 and 3 :
the connection through USB via Serial 0 works perfectly but when I try to send data with Serial3 (pins 14 and 15) the computer recieve weird datas.
It is as if the bytes are messed up.
here is the code I'm using :
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial3.begin(9600);
Serial.println("Hello World");
Serial3.println("Hello World");
}
void loop() {
if (Serial3.available()) {
int inByte = Serial3.read();
Serial.print(inByte, BYTE);
}
if (Serial.available()) {
int inByte = Serial.read();
Serial3.print(inByte, BYTE);
}
}
for example, there is what I receive instead of Hello World (in Hexa) :
00
AB 3A 3A 0A FA 8B 85 1B 27 37 E5 EB 00
I think it may be a silly mistake but I don't have clues.
I already tried to check the communication with a cross wired DB9 cable between 2 PC to see if the data was sent correctly and it works.
Also the Com port configuration is : 9600 bps - 8 bits - No Parity - 1 Bit Stop - No Control
Do you have any ideas ?