Use Python or Java to test PC to remote XBees?


Should I use Python, Java or somthing else?

I’m looking for code examples to test collecting analog and digital inputs from remote XBee 2.5 devices. I want to write test programs on my PC connected to a coordinator. Once the PC program is working properly then I’ll port it to C to run on a microcontroller.

I can drive the modules with X-CTU easily, but Python has proven more difficult. However I really need to use the API mode.

There are a few examples on the web for Python and Java but they are poorly documented. Python libraries are available but apart from some random example code there is no documentation on how to use the libraries. Well not that I can find.

I’ve seen some Java libraries. Maybe these are better supported.

Advice please.

It seems like everyone wants example code and documented libraries for getting and setting IO on remote devices. Maybe Digi has these already, but I can’t find them.

Digi’s ConnectPort-X gateways (and other capable products) use an embedded python 2.4.3 interpreter, so if you may eventually port your application to a ConnectPort X you’d likely want to go that route. We also have a wealth of python code examples to do various things at this link:

The other thing I need to mention is that development on the ZNet 2.5 stack has ended, so I’d highly recommend migrating your wireless network from ZNet 2.5 to ZB before beginning your development.

Though we still offer ZNet 2.5 modules to customers with applications based on that technology, most of the examples at our Python wiki will be ZB-based.

Instructions on how to migrate from ZNet 2.5 to ZB can be found here:

Thanks for the reply.

I had the upgrade kit, so I’ve done the upgrade. Just have to figure out what config changes are necessary to run the range tests again.

I guess this thread should move forums now.

The application will never use ip, so the ConnectPort option is not suitable.

The Python Wiki is good, but concentrates on Digi hardware like ConnectPort , adaptors etc. This isn’t surprising. Some of the code might be suitable. It is well documented.

What I really want is a well documented guide to show how to run Python on a PC and connect a ZB device to others for reading hardware.

An equivalent C version would be even better. When the code runs perfectly on the PC it could be easily ported to a microcontroller.

I’ve moved your thread to a forum more apt to get a response by programmers, since that’s who your question is directed at.

As far as running python from a PC, you’ll need the for PC file: