Skip to content

Instantly share code, notes, and snippets.

@Skwerl
Created September 23, 2013 02:01
Show Gist options
  • Save Skwerl/6665684 to your computer and use it in GitHub Desktop.
Save Skwerl/6665684 to your computer and use it in GitHub Desktop.
this was almost giving me xbee rssi
byte getRSSI() {
// I'm only seeing 13 or 18... This function needs work.
union {byte B; char C;} atCmd[3];
AtCommandRequest atCmdReq;
AtCommandResponse atResp;
byte respLen, *resp, dBm;
strcpy(&atCmd[0].C, "DB");
atCmdReq = AtCommandRequest(&atCmd[0].B);
atResp = AtCommandResponse();
xbee.send(atCmdReq);
if (xbee.readPacket(5000)) {
if (xbee.getResponse().getApiId() == AT_COMMAND_RESPONSE) {
xbee.getResponse().getAtCommandResponse(atResp);
if (atResp.isOk()) {
respLen = atResp.getValueLength();
if (respLen == 1) {
resp = atResp.getValue();
dBm = resp[0];
return dBm;
} else {
//Serial.println("Unexpected response");
}
} else {
//Serial.println("ERROR");
}
} else {
//Serial.println("Unknown response");
}
} else {
//Serial.println("No response");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment