Xbees Arduino Communication Freeze

Hi guys,

Background: I am using two Xbees coupled to two Arduinos using Xbee shields to control a robot. I am using one Arduino/Xbee combination as the controller and the other as a robot with motors. I have joysticks on the controller which I am using to control my DC motors on the robot.

Issue: I can successfully send and recieve data, however, I get occasional data freezes where the recieved data simply freezes for a couple seconds then continues (I can watch this on the serial monitor). This doesn't occur when I change the delay in my 'controller' Arduino program to about 500 ms. However, this is too slow to run the robot.

Any suggestions???

Controller.ino (1.37 KB)

RobotXbee_2.ino (2.73 KB)

  delay(100);

It is stupid to delay on the receiver ends. STOP DOING THAT.

   // Reset communication read variables
   for (index = 0; index <6; index++){
   msg[index] = '\0';
   msg2[index] = '\0';
   }

You clearly haven't a clue what NULL-terminated means. That is COMPLETELY unnecessary.