Xbee-Arduino Communication

Hello, I am doing a small wireless project using two XBeeS2. Both the Xbee's i.e router and co-ordinator are connected to two arduino boards. The router part sends the analog values from those taken by the router arduino and sends it to co-ordinator. In the co-ordinator part I have bypassed the XBee by connecting reset pin of the arduino to ground and connecting TX(Xbee) to TX(arduino) and RX(XBee) to RX(arduino). I am able to get the serial as it is in the co-ordinator serial monitor of co-ordinator arduino but along with the serial i am getting strange characters like "%,#,!,~," etc. in front as well as at the end of the required string. How can I get rid of this strange characters and get the serial as it is on the co-ordinator side.

[u]My Co-ordinator code:[/u]

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

void loop() { If(Serial.available() > 0); Serial.print = Serial.read(); Serial.println(); delay(2000); }

By using ths code I am able to get the router data as it is on the co-ordinator side but with that strange characters. Please help me in solving out this issue.

Thanks, in advance. :)

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. I believe they are also relevant to XBee comms.


Your coordinator code hasn’t a hope in hell of compiling, so it is NOT your coordinator code.

Try again. AND post your router code, too.