Problem with Arduino + Xbee DigiMesh API


Sorry about my poor english, I hope that your undestand

I´m new in programming with Xbee DigiMesh 2.4, i was know if is possible program the Xbee with Arduino without use a specific library. I want program just the basic commands of arduino.

Somebody can help me ?

Thank You

Is your question, can your load your own code on the XBee?

My question is if I can put the packages api in the code of arduino without use a specify library, as seen in many instances citing this library
I´m thinking in put the api package directly in arduino code, it is possible?

Okay - yes, you can easily program the API frames. They are just binary strings with a block-checksum. You might want to download and look over samples like the Google code (but it is Java).

Some simple routines are here:

Just remember that the API port will be full-duplex, so your Arduino might send a request, and the next ‘response’ it sees is NOT the answer, but something else (a TX status, a mesh event, a request from another XBee).

Thank you Lynnl, I´ll read about this, Do you know other library? I don´t know Java, I know C or C++

You could try this one:

Just search google for “xbee ansi c source” and you should avoid seeing the Python/Java forms.

API frames are not hard to work with.

You main problem (if you are new programmer) is designing a system where you can handle when the next response/message is important, but NOT the one you need to wait for. It means you cannot make a simple “A, then B, then C” linear program.

Oops! That google project has no code. i checked out the SVN and the directory only holds .svn overhead, but no actual files.

But I see other ones, such as a simple file at Just browse with the above google search until you find something you like.

thanks, I’ll be checking. It’s much harder not to use the library? or I have to use a library?

You don’t really need a libray.

In the end, you just need:

  1. a routine to calc BCC/checksum
  2. a routine to read each command you want to send
  3. a rotinue to decode each command you expect to receive
  4. somethign smart enough to detect the received messages you do NOT expect, so that they can be ignored.

If you are competent in C/C++, these shouldn’t take you more than an afternoon (or a few days). I won’t expect the basic code to be more than 2 printed pages.