Go Down

Topic: arduino + xbee znet 2.5 + api (Read 1 time) previous topic - next topic

jose_francisco

my eyes start to blooding.

Google doesn't show more new links

does anyone know a link/tutorial/... that shows how to configure a 2.5 znet API mesh and also shows a pair a sketches for arduino using the API library?

Thank you very much

jose_francisco

Ok. I've got something

i'm using a arduino w/o atmega + xbee shield coordinator 2.5 api + usb + serial monitor

in the router i use this code:
uint8_t payload[] = {'t','e','s','t'};

but in the coordinator + usb i get:

âÂu(and more strange characters)½èè?}test

if i put a avr in coordinator and this code:

Code: [Select]

void loop() {
   
   xbee.readPacket();
   
   if (xbee.getResponse().isAvailable()) {
     // got something
     
     if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
       // got a zb rx packet
       
       // now fill our zb rx class
       xbee.getResponse().getZBRxResponse(rx);
           
       if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) {
           // the sender got an ACK
           flashLed(statusLed, 10, 10);
       } else {
           // we got it (obviously) but sender didn't get an ACK
           flashLed(errorLed, 2, 20);
       }
       // set dataLed PWM to value of the first byte in the data
       if (rx.getData(0)=='z') flashLed(errorLed,1,1000);
     } else if (xbee.getResponse().getApiId() == MODEM_STATUS_RESPONSE) {
       xbee.getResponse().getModemStatusResponse(msr);
       // the local XBee sends this response on certain events, like association/dissociation
       
       if (msr.getStatus() == ASSOCIATED) {
         // yay this is great.  flash led
         flashLed(statusLed, 10, 10);
       } else if (msr.getStatus() == DISASSOCIATED) {
         // this is awful.. flash led to show our discontent
         flashLed(errorLed, 10, 10);
       } else {
         // another status
         flashLed(statusLed, 5, 10);
       }
     } else {
           // not something we were expecting
       flashLed(errorLed, 1, 250);    
     }
   }
}




I always get the "//not somethig we were expecting" option

i have ap=2 and ao=1

any help will be welcomed
thanks

jose_francisco

I've got something in the receiver but is not a packet.

the sender get an ack
this is the code in sender

// Check if it was delivered
          if (txStatus.getDeliveryStatus() == SUCCESS) {
               // Packet was successfully delivered
                               digitalWrite(13,HIGH);
               
          } else {
               // The remote XBee did not receive our packet. is it powered on?
               digitalWrite(13,LOW);
          }

but the receiver doesn't now what is it.
this is the code in receiver

else {
           // not something we were expecting
       flashLed(errorLed, 3, 100);    
     }

This code is from examples in arduino-api library

see you

Go Up