Greetings everyone,
I've got 2 Xbees Series 1 and each one is attached to an Arduino Uno via Xbee Shield and both are connected to the PC. Both Xbees are configured and have the same Channel and PAN ID on XCTU.
How can I make them talk to each other to show RSSI readings on the Serial Monitor? I've been trying the codes on this website: Reading XBee RSSI with Arduino | David Beath but I'm getting this weird error message.
Anyway, should I upload a "receiver" code to one Arduino and a "transmitter" code to the other? if so, where can I find such codes? Also, do I send the message from XCTU or from the transmitting Arduino's IDE? ...I'm new to Xbee and Arduino.
Any help would be greatly appreciated.
Thanks in advance,
Regards,
Booker_DeWitt:
How can I make them talk to each other to show RSSI readings on the Serial Monitor? I've been trying the codes on this website: Reading XBee RSSI with Arduino | David Beath but I'm getting this weird error message.
Please post your code in tags.
Booker_DeWitt:
Anyway, should I upload a "receiver" code to one Arduino and a "transmitter" code to the other?
Yup!
Booker_DeWitt:
Also, do I send the message from XCTU or from the transmitting Arduino's IDE? ...I'm new to Xbee and Arduino.
It depends, you can do it either from the XCTU serial interface or the Arduino serial monitor.
Alright!
Will try a few codes and then come back with updates. Thanks!
Both Xbees are on API 2 mode.
So this is the Sender code that I'm trying to upload:
#include <XBee.h>
XBee xbee = XBee();
uint8_t payload[] = { 'H', 'i' };
XBeeAddress64 addr64 = XBeeAddress64(0x0013a200, 0x403e0f30);
Tx16Request tx16 = Tx16Request(addr64, payload, sizeof(payload));
void setup()
{
xbee.begin(9600);
}
void loop()
{
xbee.send( tx16 );
delay(50);
}
And this is the Receiver code that I'm trying to upload:
#include <XBee.h>
XBee xbee = XBee();
Rx16Response rx16 = Rx16Response();
void setup()
{
xbee.begin(9600);
Serial.begin(9600);
}
void loop()
{
xbee.readPacket(100);
if (xbee.getResponse().isAvailable())
{
if (xbee.getResponse().getApiId() == RX_16_RESPONSE)
{
xbee.getResponse().getRx16Response(rx16);
Serial.print( rx16.getRssi() );
}
}
}
But I can't upload either of them because I'm getting this error:
no matching function for call to 'XBee::begin(int)'
What do I do?
Update:
Got the codes working by adding this:
Serial.begin(9600);
xbee.setSerial(Serial);
But still no RSSI values. Nothing shows on the Serial Monitor on the Receiver's side.
Any suggestions..?
Someone help? Pretty please.