Hi all!
I'm new to XBee, and have been trying for about a week to get two modules to talk to one-another with NewSoftSerial. I have two Arduinos. One Duemilanove + XBee + Adafruit breakout board connected to my computer (coordinator). And a Mega + XBee + Adafruit breakout board for the end-point.
I started by following LadyAda's XBee tutorial, but it seems to be missing some pieces (or at least it didn't work for me when I tried it).
I've set the network id's to 1337. Both have unique MY's. Arduino's have Rx to pin 2, Tx to pin 3. Since this didn't work, I've since upgraded firmwares and set the destinations to the specific S/N of each unit (both high and low for both coordinator and end-point).
I thought I had them working when I swapped the pins (Tx to 2, Rx to 3), but the coordinator was getting data that it was sending. Oddly enough, the coordinator would get the data when the end-point should have sent it.
Code is as follows...
Coordinator:
#include <NewSoftSerial.h>
// --> mLight Server <--
boolean conn=false;
NewSoftSerial xbee(2,3);
void setup(){
xbee.begin(9600);
Serial.begin(9600);
Serial.println("> mLight Online <");
}
char* getData(){
char* tmp;
while (xbee.available()){
*tmp++ = (char)xbee.read();
}
return tmp;
}
void loop(){
if (!conn){
xbee.print("HELLO");
delay(500);
Serial.println(getData());
}
delay(500);
}
End-point:
#include <NewSoftSerial.h>
// --> mLight Client <--
NewSoftSerial xbee(2,3);
void setup(){
xbee.begin(9600);
}
void loop(){
xbee.print("HIYO");
delay(1000);
}
They got really basic after the XBees refused to properly communicate...
If I swap the pins back to how it should look (I think), I get no data being sent back-n-forth.
Sorry if I'm confusing, I've tried basically everything to get NewSoftSerial to talk with my XBees. My power lights go on, but the only way to get the RSS lights to trigger is to hook them up with what I assume is backwards (but I don't know anymore).
Thanks in advance for any help. Adafruit forums were essentially useless for me. On one final note, Adafruit sent me two different (but basically the same units). One just displays Digi's tag and "S1" on the face, while the other display's MaxStream's tag with no "S1".