Serial Comms Mega2560 R3 Wifi

Hi there,

I'm having issues with the Mega2560 Wifi board, and wondered if anyone can help?

I've got two very simple sketches on the ESP side and the Mega side.

ESP:
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Hello!");
delay(500);
}

Mega Side:
void setup() {
Serial.begin(9600);
Serial3.begin(9600);
}
void loop() {
while (Serial3.available() > 0){
String bob = Serial3.readString();
Serial.println(bob);
}
}

I've got all the dip switches in the right position (1,2,3,4 on, 5,6,7 off), however they seemingly don't communicate over serial3. I've verified that the ESP is sending by monitoring the serial with dip switches 5 & 6 on.

Whilst in RXD0 mode, the Tx light flashes at the correct interval, but If I change from RXD0 to RXD3, all the Tx/Rx lights go off, and then when I switch back to RXD0, it "dumps" all of the "hello's" onto serial0 that it's received whilst its been in RXD3 mode, but won't pull any further through to 0.

I'm starting to think that the board or one of it's switches may be at fault, but thought I'd ask before shelling out for a new one!

Thanks in advance!

there is one more switch for Serial3 on board

Is there? In addition to the RXD/TXD0/3 switch?

sorry, I meant that one

No probs, thank you anyway.

I guess the switch is playing up and I’ll have to get a new board!

readString has a 1 second timeout so it will collect the input every 500 millis forever

char c = Serial3.read();
Serial.print(c);

Thanks Juraj, issue remains still though. It's like when it's in TXD3, it builds up the inputs and then spits them all out as soon as it's switched back to 0. Very odd.

that is exactly what your test sketch with readString() would do while receiving data every 500 milliseconds

I've set up as

void setup() {
Serial.begin(9600);
Serial3.begin(9600);

}

void loop() {

while (Serial3.available() > 0){
char c = Serial3.read();
Serial.print(c);

}

}

But it still only pulls any values through from Serial3 on the moment of RXD3 being switched back to RXD0.

check if the upload was successful

Yeah confirmed to be successful

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.