XBees in API mode?


Has anyone here used the XBees in API mode?

I can talk to the XBees from a Java program - I can send AT commands within an API frame and get a proper reply. I use a Diecimila without the microcontroller to talk directly to the XBee.

What doesn't work is doing the same from the Arduino. I never get a reply. Eventually, I am just sending incorrectly - however, I don't think so anymore.

The easiest way to send Hexadecimals is to send them as a String, isn't it? For example, if I want to send 0x1F, the the easiest way is Serial.print("1F").

All I might need to see is a few lines of code for an Arduino that send a correct API frame. Unluckily, I haven't found it in the web.

regards, Dieter

I don't know about the API mode on the XBee (I'd love to know more on that too!), but if you want to send a byte, you can't do Serial.print("1F"), because that will send the ASCII values for the characters 1 and F. You want to send an actual byte. A single char is a single byte, so you can use as a data holder. ie: char myByte= 0x1F; Now that char is holding the byte you want, and you can send that char: Serial.print(myByte). Or even simpler: Serial.print(0x1F). (Pretty sure you can do that). Hope that helps!

Thanks for replying

I'm trying to run my network in AT mode now, though. After some rethinking, I assume I don't need to broadcast regularly. Then The AT command has a benefit: I can use more of the bandwidth for data transfer.

thx, Dieter