I'm using the SoftwareSerial library with a 9600 baud rate. On the receiving xbee, the red RSSI LED turns on once the transmitter is turned on. I configured the xbees using X-CTU. For each xbee, I set the Destination Address H/L to the Serial Number H/L of the other xbee. I set the baud rate to 9600 and the Pan IDs are the same. I'm just transmitting a constant number "4", and it displays on the receiving side as "134".
Here is my transmitter code:
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial xbee= SoftwareSerial(3,8); // RX connected to Xbee TX, TX connected to Xbee RX
void setup()
{
pinMode(3,OUTPUT);
Serial.begin(9600);
xbee.begin(9600);
}
void loop()
{
byte data = 4;
xbee.print(data);
delay(50);
}
Code: Select all
#include <SoftwareSerial.h>
SoftwareSerial xbee = SoftwareSerial(10,11); //RX connected to Xbee TX, TX connected to Xbee RX
void setup()
{
pinMode(11,INPUT);
Serial.begin(9600);
xbee.begin(9600);
}
void loop()
{
if (xbee.available())
{
byte c = xbee.read();
Serial.println("val:");
Serial.println(c,DEC);
}
}