Go Down

Topic: XBee API tutorials for Arduino? (Read 4 times) previous topic - next topic

Jack Christensen

The various sensors just need to communicate to the one XBee attached to the computer, and not with each other? Don't know much about Processing, but if there's an API library for it, hopefully things can be made to talk.

When the sensor nodes need to send data, I do something like this:

Code: [Select]
#include <XBee.h>                //http://code.google.com/p/xbee-arduino/

#define XBEE_PAYLOAD_LEN 32

XBee xbee = XBee();                    //instantiate the XBee object
union {byte b; char c;} xbeePayload[XBEE_PAYLOAD_LEN];
ZBTxRequest zbTX = ZBTxRequest();
XBeeAddress64 coordAddr = XBeeAddress64(0x0, 0x0);

void setup(void)
{
    xbee.begin(115200);
    buildDataPayload();
    zbTX.setAddress64(coordAddr);
    zbTX.setAddress16(0xFFFE);
    zbTX.setPayload(&xbeePayload[0].b);
    zbTX.setPayloadLength(strlen(&xbeePayload[0].c));
    xbee.send(zbTX);
}

void loop(void)
{
}

void buildDataPayload()
{
    //whatever is needed to build the payload
}
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

scottsullivan

Thanks Jack, that gives me a lot to build on. I appreciate it!

scottsullivan

If there is anyone who has used the Processing API, please let me know- I've hit a bit of a wall here.

draythomp

Are you talking about the library that Rob Faludi created for processing?  If so, he has a lot of info in his book and there is quite a bit online as well.  A little google search using his name and processing will show this stuff.
Trying to keep my house under control http://www.desert-home.com/

scottsullivan


Go Up