I've trouble making arduinos xbees communicate to each other through xbees.
Series 2 xbees are used and is connected to arduinos using xbee shield.
They have been configured using xctu.
sender code void setup() { Serial.begin(9600); } void loop() { Serial.println("H"); //turn on the LED delay(1000); Serial.println("L");//turn off the LED delay(1000); } receiver code msg = ' '; const int led = 13; void setup() { Serial.begin(9600); pinMode(led,OUTPUT); } void loop() { while(Serial.available() > 0) { msg=Serial.read(); if(msg=='H') { digitalWrite(led,HIGH); } if(msg=='L') { digitalWrite(led,LOW); } delay(1000); } } Please help me out with this.
How are you connecting the Xbee's to your Arduinos?
Have you looked at the reference information for your connection method (IE the official shield: http://arduino.cc/en/Main/ArduinoWirelessShield has information that could explain your issues)
Have you tried your receiver code via just the USB (no shield) to see if it works?
Have you tried your sender code via just the USB (no shield) to see if it works?
Looking at your code, your receiver code doesn't need the delay, I don't think that is your issue, but it could cause some odd or unexpected behavior.