Hey Paul.
By "sending debug data" you mean the Serial.print?
Am I wrong in assuming that "Serial.write" goes to Xbee and "Serial.print" goes to pc?
If this is so - in the specific cases where it goes wrong, I do not have any of this mix up.
Receiver - In this instance sends a confirmation:
case Play:
//take care of variable speed
stepper.setMaxSpeed(speedValue);
stepper.moveTo(outPoint);
stepper.run();
//Serial.println ("Pcase");
if(stepper.currentPosition()==outPoint)
{
Serial.write (1);
mode=Stop;
}
break;
Sender - In this loop waits for confirmation and needs to act
if (Serial.available())
{
dataReceive = Serial.read();
if (dataReceive == 1)
{
pClickedOnce = false;
digitalWrite(playLED, LOW);
}
}