Problem verifying remotely that an Arduino/XBee unit has been turned off.

My setup includes: 2 arduino uno, 2 arduino wireless proto, 2 XBee pro
I am writing my sketches using only the standard library.

The coordinator unit sends numbers 1, 2 and 3. The receiver uses the 1 to indicate the coordinator (“transmitter”) is turned on, uses 2 to detect motion and 3 to indicate motion has ceased. I remotely turn on and off both the coordinator and receiver. I can see the receiver and thereby know I have turned it off. However, I can not easily see the coordinator and verify it is turned off. I am hoping I can find a way of turning off the “transmitter” led when the coordinator is turned off remotely. I thought checking when Serial_available() is less than 0, I could turn off the “transmitter” led. I assumed this would only occur when the coordinator was turned off. I have discovered it happens when the coordinator is turned on. From that point on the “transmitter” led remains off. I don’t understand why this is true. From what I can see the coordinator continues to send all the numbers I expect. I thought the receiver’s buffer would be filled all of the time. I guessing it empties for short periods between the transmission of data, thereby turning off the led when it should not. I want it turned off only when the coordinator is turned off. When the buffer empties, maybe the sketch should see if the “transmitter” led is turned on and if it is then turn it off only after several seconds have elapsed, like when checking for motion cessation.

What I have learned is Serial_available() is greater than 0 when there is data in the buffer and Serial_read() reads serially the bytes in the buffer and is -1 when there is nothing to read.

Maybe another approach is available. Is there any way that the coordinator can be interrogated for a turned off state. Can I use something other than the cessation of data?

I don't think I understand what you mean by "turned off".

In common language it means that the electrical power to a device has been disconnected with some switch. If a device is turned off like that I think it would be impossible to tell remotely whether it was off or had just malfunctioned so it couldn't respond to requests for data. I think you would need another device to monitor it - but it, also, could malfunction.

...R

Here I meant the turning off of the electrical power. However, I would expect the same response if the coordinator malfunctioned.

I can't think of any way to distinguish between a malfunction and the power being switched off - apart from having a separate monitoring device.

You could enable the watchdog timer in the devices which would greatly reduce the probability of the device stopping indefinitely due to a code malfunction.

...R

I need only focus on how to detect when the electrical power is turned off to the coordinator. Maybe I have the answer in: "When the buffer empties, maybe the sketch should see if the “transmitter” led is turned on and if it is then turn it off only after several seconds have elapsed, like when checking for motion cessation." I will start work on the sketch and see if it works.

It seems that whatever is in your mind is very different from what is in mine - and I'm not suggesting you are wrong.

...R