Hi javlig
Thanks for creating this thread! It seems to be a slight gap in the Waspmote documentation.
Is there any particular reason you've set the gateway/coordinator to API mode? I find that it makes it difficult to read values from it in that. The waspmote/router must be set to the extended API mode, but as far as I know, the Gateway doesn't have to be.
The problem I seemed to have was that the firmware I had set on my Xbees wasn't matched to the software library I was using. What firmware version i.e. number code have you uploaded to your Xbees?
I've actually used code very similar to your original posting:
Code:
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char* data="Test message!";
int g=0;
void setup()
{
// Inits the XBee Zigbee library
xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
// Powers XBee
xbeeZB.ON();
xbeeZB.setNodeIdentifier("test_node");
}
void loop()
{
xbeeZB.getChannel();
XBee.println(xbeeZB.channel,HEX);
paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=UNICAST;
paq_sent->MY_known=0;
paq_sent->packetID=0x52;
paq_sent->opt=0;
xbeeZB.hops=0;
//xbeeZB.setOriginParams(paq_sent, "0013A2004030C153", MAC_TYPE);
xbeeZB.setOriginParams(paq_sent, "node_test", NI_TYPE);
//xbeeZB.setDestinationParams(paq_sent, "0013A200403A8933", data, MAC_TYPE, DATA_ABSOLUTE);
xbeeZB.setDestinationParams(paq_sent, "node_gateway", data, NI_TYPE, DATA_ABSOLUTE);
xbeeZB.sendXBee(paq_sent);
if( xbeeZB.error_TX )
{
XBee.print("Error");
XBee.println(xbeeZB.error_TX);
}
free(paq_sent);
paq_sent=NULL;
Utils.blinkLEDs(500);
delay(500);
}
I obviously set my gateway to have a node identifier of "test_gateway" when using that addressing mode. As far as I can tell, the default networking settings should work for this simple example (i.e. the router should choose the only available PAN, the one created by the Coordinator, and the same with the channel scanning procedure). What happens when you try this simple code?
Cheers,
Gordon