Created
September 23, 2013 02:01
-
-
Save Skwerl/6665684 to your computer and use it in GitHub Desktop.
this was almost giving me xbee rssi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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