Serial com between Xadow main board and Arduino

Hello,
I have bougth several boards from seeed: Xadow main board , multigaz sensor board and breakout board and the last storage board.
Anyway, my wish would be to transmit data (CH4, N2O…) coming from xadow to MEGA arduino with Rx, Tx , Gnd pins from the breackout board. I check speed (9600 it is ok) and unfortunately I do not manage to do that.

Is there a way to do that?

My code in the MEGA arduino is the following:

char str[4];

void setup() {
Serial.begin(115200);
Serial2.begin(9600);
}

void loop() {
int i=0;
if (Serial2.available()) {
delay(100); //allows all serial sent to be received together
while(Serial2.available() && i<4) {
str[i++] = Serial2.read();
}
str[i++]=’\0’;
}

if(i>0) {
Serial.println(str);
}
}

and in the xadow main board it is your code that you provided. I have configured 9600 bauds for serial communication.

Then can you tell if it is normal not to receive data. I connect Tx , Rx from the breakout board to Rx2, Tx2, and GND to MEGA arduino.

I hope you will be able to help me !

Thank you

Pascal.

Hello,

Thanks for contacting us. We have not checked your code. Let us provide a generic guide to implement your application:

1.Implement the Xadow code to transmit data via UART. Use a USB2Serial port board and verify the output from UART in serial terminal.
2.Implement the code in Mega to receive data from UART and send it to PC via another UART. Test the same using USB2Serial by sending data.
3.Now, you could connect Xadow output to Mega.

Alternatively, you could use I2C in master slave mode to Tx-RX data. There is nice tutorial and software available here.

Thanks and Warm Regards