Dear Libelium,
I have tried to execute what you have to recommend:
i configure the XBees(ROUTER API and Coordniate API Gateway)
1- All XBees are in the same network that the Gateway (or Meshlium). In Waspmote's API, PANID parameter is set with “setPAN” function
2- All XBees are in the same channel.
3- All XBees are configured to 38400 bps
4-All XBees have the same encryption options
5- All Waspmotes' XBees are set in mode AP = 2 (API mode)
and I also reassures even if the modules are in the same network as I used the example from the Waspmote(WaspXBeeZB_1_CreatingNetzwork) and i have a Confirmation that my API set.
now i use this simple example from Libelium to send the message to the Gateway.
Code:
packetXBee* paq_sent;
int8_t state=0;
long previous=0;
char aux[200];
char* macHigh=" ";
char* macLow=" ";
int aux_1 = 0;
int aux_2 = 0;
#define key_access "LIBELIUM"
uint8_t direction[8]={ 0x00, 0x13, 0xA2, 0x00, 0x40, 0x55, 0x95, 0xC1 };
void setup(){
// Store key access in EEPROM
for(int i=0;i<8;i++){
Utils.writeEEPROM(i+107,key_access[i]);
}
RTC.ON();
ACC.ON();
XBee.setMode(XBEE_ON);
XBee.begin(9600);
delay(1000);
XBee.print("+++");
delay(2000);
XBee.println("ATBD5,AP2,WR,CN");
delay(150);
XBee.setMode(XBEE_OFF);
XBee.close();
Utils.setLED(LED0, LED_ON);
Utils.setLED(LED1, LED_ON);
delay(5000);
Utils.setLED(LED0, LED_OFF);
Utils.setLED(LED1, LED_OFF);
for (int i=0;i<24;i++){
Utils.blinkLEDs(125);
}
// Inits the XBee XSC library
xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL);
// Powers XBee
xbeeZB.ON();
// Get the XBee MAC address
delay(500);
int counter = 0;
while(xbeeZB.getOwnMac()==1&&counter<4){
xbeeZB.getOwnMac();
counter++;
}
Utils.hex2str(xbeeZB.sourceMacHigh,macHigh,4);
Utils.hex2str(xbeeZB.sourceMacLow,macLow,4);
}
void loop(){
sprintf(aux,"-mac:%s%s -x:%d,y:%d,z:%d -temp:%d -bat: %d%c%c%c",macHigh,macLow,ACC.getX(),ACC.getY(),ACC.getZ(),RTC.getTemperature(),PWR.getBatteryLevel(),'%','\r','\n');
paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee));
paq_sent->mode=BROADCAST;
paq_sent->MY_known=0;
paq_sent->packetID=0x52;
paq_sent->opt=0;
xbeeZB.hops=0;
xbeeZB.setOriginParams(paq_sent,"0013A2004055A4F3",MAC_TYPE);
xbeeZB.setDestinationParams(paq_sent, direction, aux, MAC_TYPE, DATA_ABSOLUTE);
xbeeZB.sendXBee(paq_sent);
free(paq_sent);
paq_sent = NULL;
delay(1000);
}
but my sketch does not send data through XBee, but through USB. I need to send a Wireless message and i don´t know what is the problem now.
I´m doing step by step the Configuration of the XBees throught X-CTU..