Stalker 2.0 XBee sample code

Hello.

I’m looking for a code snippet to use Xbee module with Stalker 2.0. I don’t have very clear how to manage it, for example, which PIN do I have to use to communicate with the module? Do you have any sample?

Thanks

Maybe one question first: are you looking for “hand wirtten” code or the XBee library to be included in the sketch ??

For the first choice I recommend the book “Wireless Sensor Networks” by Robert Faludi where you may find description how it works and commented code for different applications.

In my test application (sending of temperature readings of BMP085 sensor and the accu voltage from Stalker v2.0) I used the XBee library which can be found here: code.google.com/p/xbee-arduino/ There are some sample sketches in the installation.

There is no problem to provide my code if you want it but I will have to clear it and comment it before as it is very “raw” now … :slight_smile:

Let me know and I can make that on your request … :wink:

Cheers

Thanks so much synekvl!

Yes, I have the library. If you don’t mind to share your code, I’d be happy to have a look to it.
Even if it’s at an early stage, don’t mind, I’ll try to follow it even without comments :wink:

Thanks so much for your help.

Hi,

attached you may find the sketch for Arduino IDE. My version is the last i.e. 0022. The sketch coding is taken from BMP085 reading found on SparkFun’s webpages, Battery files from Stalker sample sketch and XBee library from already given place. Everything is “cooked” together and … it seems it works. Stalker v2.0 reads every +/-10 sec temperature of BMP085 sensor ( format is “Whole”.“Fract” ), accu voltage ( i.e. 4.12V equals to “412” ), charging status and transmit all these values via XBee to another Arduino Mega with XBee and Network shields and send further these values with another ones from Barometric sensor to Pachube.

Please take into account that the sketch file is not well commented and the “payload” for transmission is not completed yet ( until now negative temperature sign is not being sent - it is summer and the temperature is positive :slight_smile: ) …

If there is something unclear let me know and I will try to explain what is going on :wink:

Cheers
Vladimir
XBee_Tx_test2_TempVoltage.zip (3.36 KB)