Hey guys,
I'm having a bit of a problem. Currently Im trying to work with arduino and xbee and it's been working great.
Xbee is used in api mode, and thanks to the great arduino-xbee library getting it up and running wasn't to hard.
I was running the xbee receiving function from the main loop of the program (void loop()), but when I tried to put it in an interrupt the same code did not work. I found that the xbee library function readPacket( timeout ) could not work within the interrupt because it used millis() for the timeout.
Then I did a simple check within the interrupt function (triggering interrupt using attachInterrupt) if the serial was available. And it wasn't. Then I went on debugging, and I found something strange.
When I send a message to the arduino xbee, it triggers the interrupt. And i print the availability (so not available). When the interrupt ends, and he goes back into the main loop I print the serial availability as well and then it is available.
How is that possible??
Hope someone can help me with this problem.
Thanks in advance.
Gr.