Hello, I’m a new user and a newbie with XBee.
I’ve got 2 XBee Series 2. The controller is connected to Arduino, the router is placed on a simple xbee shield. I have to switch the status of a digital pin in the router, and also send some serial data.
I know that with XBee Series 1 I can do this in AT mode. Unfortunately I own 2 XBee Series 2 and I’ve read that I can do this only in API mode.
My problem is that when I configure the controller in API mode, the router can’t associate with the controller, the ASSOC led blink, the RSSI remain off.
Instead if I configure both xbee in AT mode I can send serial data from controller to router.
I’ve tried to configure both xbee in api mode, but the result is the same, there isn’t no connection between the two xbee.
Those are the firmware used:
Modem: XB24-B
-
First case, only serial working:
Arduino connected: ZNET 2.5 COORDINATOR AT (1047)
Remote: ZNET 2.5 ROUTER/END DEVICE AT (1247) -
Second case, no connection:
Arduino connected: ZNET 2.5 COORDINATOR API (1147)
Remote: ZNET 2.5 ROUTER/END DEVICE AT (1247) -
Third case, no connection:
Arduino connected: ZNET 2.5 COORDINATOR API (1147)
Remote: ZNET 2.5 ROUTER/END DEVICE API (1347)
In every case I’ve restored the default configuration, so I think that it’s right. I don’t understand why there’s no connection. I have to do some extra configuration if the coordinator is in API mode?
This is the code that I use to switch the pin in the remote xbee. I use this library: http://code.google.com/p/xbee-arduino/
#include
XBee xbee = XBee();
uint8_t pinCommand[] = {'D','4'};
uint8_t dOnValue[] = { 0x5 };
uint8_t dOffValue[] = { 0x4 };
XBeeAddress64 remoteAddress = XBeeAddress64(0x0013A200, 0x408C58A5);
void setup()
{
xbee.begin(9600);
// Give the XBee a few seconds to start and join the network
delay(5000);
}
void loop()
{
RemoteAtCommandRequest remoteAtRequest = RemoteAtCommandRequest(
remoteAddress,
pinCommand,
dOnValue,
sizeof(dOnValue));
xbee.send(remoteAtRequest);
delay(1000);
remoteAtRequest.clearCommandValue();
remoteAtRequest.setCommand(pinCommand);
remoteAtRequest.setCommandValue(dOffValue);
remoteAtRequest.setCommandValueLength(sizeof(dOffValue));
xbee.send(remoteAtRequest);
delay(1000);
}
Thank you.
Fabio