SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By emilybuck
#194804
I'm measuring RSSI values from data packages sent between two XBees in API mode. According to the data sheet, the RSSI values are reported as an absolute value in hex (For example: 0x58 = -88 dBm), which is accurate most of the time, for example when I have values fluctuating between 52 and 54 for a set distance.

But the reported values are always numbers and never letters (like 5A), so for one distance I can get 58,58,59,58,59,60,60,59 etc. But since this is in hex there is a gap from -89 to -96 dBm. Is it suppose to be like this? Is it really in hex? What can I do about it?

I also first set "rssi" as an int and sent it to the other XBee, and I thought this was the problem. I changed my code and instead of sending "rssi" I'm sending rx16.getRssi(), but I then get this error: warning: invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]

tx16=Tx16Request(0xFFFF, rx16.getRssi(),sizeof(rx16.getRssi()));


Code: Select all
#include <XBee.h>
XBee xbee = XBee();
Rx16Response rx16 = Rx16Response();
Tx16Request tx16;
//int rssi;

void setup() {
  Serial.begin(9600);
  xbee.begin(Serial);
}

void loop() {
  xbee.readPacket(100);
  if (xbee.getResponse().isAvailable()){
    if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
      xbee.getResponse().getRx16Response(rx16);
      Serial.println("");
      Serial.println(rx16.getRssi());
      //rssi = rx16.getRssi();
      //tx16=Tx16Request(0xFFFF, rssi,sizeof(rssi));
      tx16=Tx16Request(0xFFFF, rx16.getRssi(),sizeof(rx16.getRssi()));
      xbee.send(tx16);
     // delay(50);
    }
  }
}