Afternoon all,
Im currently using 2 Arduino Uno's and 2 XBee Series 1. Im using one as the Tx and one as the Rx and am trying to display the received Rssi.
Ive found samples of code online but Im struggling to impleament and get the final result, there is lots of infromation online regarding setting up the config of the XBees so i dont think that is the issue.
I have used XCTU to set up both my Xbees and they are configured as follows:
TX: CH = C. ID = 3332. DH = 0. DL = 1. MY = 0.
RX: CH = C. ID = 3332. DH = 0. DL = 0. MY = 1.
My XBees are wired up to my Arduino with Pins, 1,2,3 and 10 going to 3.3v, Tx, Rx and Gnd respectively.
I have looked through the forum for any previous topics on this matter that may help but with no success, also as this is my first post I have also read up on how to post code into the forum. So hopefully this is done correct, if not im sure i will be re-briefed on this.
Below is my Tx code, followed by Rx code.
#include <XBee.h>
XBee xbee = XBee();
uint8_t payload[] = { 'H', 'i' };
XBeeAddress64 addr64 = XBeeAddress64(0, 0);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
void setup()
{
Serial.begin(9600);
xbee.setSerial(Serial);
}
void loop()
{
xbee.send( zbTx );
delay(50);
}
Rx code
#include <XBee.h>
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
Rx16Response rx16 = Rx16Response();
void setup() {
Serial.begin(9600);
xbee.begin(Serial);
}
void loop() {
xbee.readPacket(50);
if (xbee.getResponse().isAvailable())
{
if (xbee.getResponse().getApiId() == RX_16_RESPONSE)
{
xbee.getResponse().getRx16Response(rx16);
Serial.print( rx16.getRssi());
}
}
}
Any help or direction would be greatly appreciated, thanks.