Skip to content

Instantly share code, notes, and snippets.

@rocketjosh
Last active August 29, 2015 14:16
Show Gist options
  • Save rocketjosh/77e3e3ee147a5be906c2 to your computer and use it in GitHub Desktop.
Save rocketjosh/77e3e3ee147a5be906c2 to your computer and use it in GitHub Desktop.
// read the CCID
fona.getSIMCCID(replybuffer); // make sure replybuffer is at least 21 bytes!
Serial.print(F("SIM CCID = "));
Serial.println(replybuffer);
break;
}
case 'i':
{
// read the RSSI
uint8_t n = fona.getRSSI();
int8_t r;
Serial.print(F("RSSI = "));
Serial.print(n);
Serial.print(": ");
if (n == 0) r = -115;
if (n == 1) r = -111;
if (n == 31) r = -52;
if ((n >= 2) && (n <= 30)) {
r = map(n, 2, 30, -110, -54);
}
Serial.print(r);
Serial.println(F(" dBm"));
break;
}
case 'n':
{
// read the network/cellular status
uint8_t n = fona.getNetworkStatus();
Serial.print(F("Network status "));
Serial.print(n);
Serial.print(F(": "));
if (n == 0) Serial.println(F("Not registered"));
if (n == 1) Serial.println(F("Registered (home)"));
if (n == 2) Serial.println(F("Not registered (searching)"));
if (n == 3) Serial.println(F("Denied"));
if (n == 4) Serial.println(F("Unknown"));
if (n == 5) Serial.println(F("Registered roaming"));
break;
}
/*** Audio ***/
case 'v':
{
// set volume
flushSerial();
Serial.print(F("Set Vol %"));
uint8_t vol = readnumber();
Serial.println();
if (! fona.setVolume(vol)) {
Serial.println(F("Failed"));
}
else {
Serial.println(F("OK!"));
}
break;
}
case 'V':
{
uint8_t v = fona.getVolume();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment