xbee-arduino
xbee-arduino copied to clipboard
Small problem in AtCommand example
Hi,
I'm using xBee modules Series 2, and getting a small problem with the AtCommand example [I downloaded the library through the IDE]. The problem is that the module sends a Modem Status (type 8A) message right when it starts. This means that when the code checks for a response from the first AT command, it will receive this message as a reply; then all the other responses will be offset.
I think that adding a quick call to xbee.readPacket()
at the end of the setup() function should fix this.
I also suggest that the example code be changed to give an ASCII output of what the response command is, like this:
if (atResponse.isOk()) {
SerialBridge.print("Command [");
SerialBridge.print((char)atResponse.getCommand()[0]);
SerialBridge.print((char)atResponse.getCommand()[1]);
SerialBridge.println("] was successful!");
Otherwise works well so far. Thanks !