Browse Source

Merge pull request #10 from xslim/patch-1

Add getBattVoltage for SIM800
v_master
Volodymyr Shymanskyy 8 years ago
committed by GitHub
parent
commit
dee868109e
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      TinyGsmClientSIM800.h

+ 13
- 0
TinyGsmClientSIM800.h View File

@ -512,6 +512,19 @@ public:
/* /*
* Battery functions * Battery functions
*/ */
// Use: float vBatt = modem.getBattVoltage() / 1000.0;
uint16_t getBattVoltage() {
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) {
return 0;
}
streamSkipUntil(','); // Skip
streamSkipUntil(','); // Skip
uint16_t res = stream.readStringUntil(',').toInt();
waitResponse();
return res;
}
private: private:
int modemConnect(const char* host, uint16_t port, uint8_t mux) { int modemConnect(const char* host, uint16_t port, uint8_t mux) {


Loading…
Cancel
Save