Hi guys,
I am using 2 xbee pro s2b modules. The one is configured as Router and it is connected on an Arduino Uno through a shield, which will be used to send data. The other one is configured as Coordinator and is connected directly on a computer which will be used to receive data.
I have changed the position of the switch on the xbee shield so it uses the pins 2 and 3 for RX and TX.
My Code:
#include <XBee.h>
#include <SoftwareSerial.h>// Define SoftwareSerial TX/RX pins
#define ssRX 2
#define ssTX 3
SoftwareSerial nss = SoftwareSerial(ssRX, ssTX);//Create an XBee object
XBee xbee = XBee();//Define the Destination address of the packets
XBeeAddress64 destaddress = XBeeAddress64(0x0013A200, 0x406F1997);char Hello = “Hello World\n”;
void setup()
{
Serial.begin(9600);
nss.begin(9600);//We hook the XBee into the Software Serial
xbee.setSerial(nss);Serial.println(“Goodnight moon!”);
}void loop() // run over and over
{
Serial.println(“in the loop”);
ZBTxRequest zbtx = ZBTxRequest(destaddress, (uint8_t *)Hello, strlen(Hello));
xbee.send(zbtx);
delay(1000);
}
Output of the code:
Goodnight moon!
in the loop
~ }3¢ @o -?ÿþ Hello World
My problem is how can the “Hello World” message be displayed on the Serial Monitor when it should be transmitted to the other xbee?
I haven’t written any code for the xbee that receives data, but i used the Terminal tab of the x-ctu program to check for any incoming data. Nothing was received.
Regards,
gabys