XBee I/O
Rsadeika
Posts: 3,837
This thread will eventually become an XBee Temperature/Humidity log program, I hope. Below is the minimal code required, as per my coding experience, to work with the XBee. This works with CMM and some of the XMM modes, specifically the XMM-SPLIT... does not work.
Basically this program sends out via the XBee a "Did you get this?" message. This is the simplest form before I move into some XBee I/O stuff.
Ray
Basically this program sends out via the XBee a "Did you get this?" message. This is the simplest form before I move into some XBee I/O stuff.
Ray
/* * MyXbTHlog.c * * May 19, 2013 * * Set for Activity Board */ #include "simpletools.h" // Include simple tools /* These defines do not work with the xbee = fopen(...). */ //#define Tx 13 //#define Rx 12 //#define BAUD 9600 FILE *xbee; int main() { // Add startup code here. /* Initialise XBee for operation. */ /* Baud Tx Rx */ xbee = fopen("SSER:9600, 13, 12", "r+"); pause(300); // Terminal catch up if necessary fprintf(xbee, "Program Start.\n"); while(1) { fprintf(xbee,"Did you get this?\n"); pause(3000); // Pause for three seconds. } return 0; }
Comments
@David Betz, Thanks, I am in the habit of trying all the memory models, just to see what happens.
At this point I think I need some XBee experts to step up and join in. So far, the program is set up for a simple peer to peer transmission, it does not have any capability to have its own ID where it only responds to a specific request. I think that would be the next step, while the program is still in a very simple form. Adding this to the program will also test whether SSER is capable, or will it have to use FDS. I will look through some of my old code to see how far I got, but I do remember I did not get it to work. It seems the problem I was having was that it needed to some polling, which meant threads or multicog use, which presents its own problems.
Ray
Just so you know, simple libraries + examples for the various peripherals you are working on and many others will be appearing in the Learn folder throughout he summer. The XBee object is waiting on some under the hood changes to the learn library that should be happening over the next couple weeks. If you want an to work with some interim code, please send me a PM.
Thanks, Andy