--- title: TinyGsmBattery --- # TinyGsmBattery (class) **Module:** **[TinyGsmBattery](class_tiny_gsm_battery.html)** The CRTP parent class for battery functions. `#include ` ## Battery functions ### Public Functions | | Name | | -------------- | -------------- | | int16_t | **[getBattVoltage](#af41311b4c55dea716a0ef6afd14846ac)**()
Get the current battery voltage. | | int8_t | **[getBattPercent](#a349ded65e22bc04beb5dd320b58965d6)**()
Get the current battery percent. | | int8_t | **[getBattChargeState](#ac2179871063de50df9e3134a049f68b0)**()
Get the battery charging state. | | bool | **[getBattStats](#a0aeea9308d460dcd811089c5821eada3)**(int8_t & chargeState, int8_t & percent, int16_t & milliVolts)
Get the all battery state. | ## Public Functions Documentation ### Battery functions #### functiongetBattVoltage ```cpp int16_t getBattVoltage() ``` > [!NOTE] > Unless you have a battery directly connected to your modem module, this will be the input voltage going to the module from your main processor board, not the battery voltage of your main processor. - **Return**: The battery voltage measured by the modem module. #### functiongetBattPercent ```cpp int8_t getBattPercent() ``` > [!NOTE] > Unless you have a battery directly connected to your modem module, this will be the percent from the input voltage going to the module from your main processor board, not the battery percent of your main processor. - **Return**: The current battery percent. #### functiongetBattChargeState ```cpp int8_t getBattChargeState() ``` - **Return**: The battery charge state. #### functiongetBattStats ```cpp bool getBattStats(int8_t & chargeState, int8_t & percent, int16_t & milliVolts) ``` - **Parameters**: - **chargeState** A reference to an int to set to the battery charge state - **percent** A reference to an int to set to the battery percent - **milliVolts** A reference to an int to set to the battery voltage - **Return**: True if the battery stats were updated by the module, false otherwise. ------------------------------- Generated by [Doxygen](https://www.doxygen.nl) and [m.css](https://mcss.mosra.cz/) with templates from [doxybook2](https://github.com/matusnovak/doxybook2) Updated on 2026-09-11