XBee to XBee

I think the code looks fine now. IF or WHILE does not matter.

I'm not terribly familiar with those XBee shields, I just use adapter boards. I know there are jumpers that need to be set up correctly, they will need to be different for programming the XBees vs. operating. In addition to the associate LED, is there another one, possibly labeled RSS or similar? This would illuminate when data is transmitted.

I'm assuming the XBee "AT" firmware is loaded, as opposed to the "API" firmware.