I have multiple xbees (15) acting as endpoints and talking to a coordinator. Each endpoint module has two pushbuttons connected to digital input pins, and I need to detect from the central node (coordinator) if any of the pushbutton is pressed. I`m using an arduino connected to the coordinator Xbee to get the data.
On my first approach I configured two digital pins on the endpoint xbee and the same pins on the coordinator. Then, using arduino to read the digital outputs of the coordinator I was able to detect if the pushbutton of the endpoint was pressed. the "OnChange" parameter was enabled at the endpoint.
The problem with this is that as I said before, there will be 15 endpoints, so reading the digital pins of the coordinator wouldn't provide the source address of the endpoint whose pushbutton was pressed. I need to know wich of the endpoints pressed a button.
To solve this I'm tying to receive the information using the coordinator's UART serial port (DOUT). I read that the information is sent using the API frame format. Using arduino I can visualize the information, and I've identified the starting identifier, but I'm having a really hard time trying to extract the payload, computing the checksum, etc.
Do you think this is a correct way for reading pushbuttons connected to multiple endpoints?
Can you suggest a way for getting the source ID when performing a digital read at the coordinator?
Do you think I need to run the Xbees in API mode? why?
I'm using XbeePRO (XBP24) and Arduino Mega.
Thank you very much for your comments.