Home - Getting Started - Constructor - Initialization - Functions - Examples
deviceFound() - findFirstDevice() - address() - adc() - voltage() - percent() - version() - compensation() - sleep() - isSleeping() - wake() - reset() - quickstart() - alertIsActive() - clearAlert() - threshold()
percent()
Description
Gets the state of charge represented as a percentage from the SOC register of the device.
Parameters
Optional constrain : bool
Returns
percent : float
Example
This snippet of code demonstrates how to get the current battery percentage and display it on the serial port.
float percent = FuelGauge.percent();
Serial.print("Battery is at "); Serial.print(percent); Serial.println("%");
Notes
This value is determined by the device and not computed as part of this library.
If constrain
is true, the percent returned will be constrained bewtween 0% and 100%. The default is false.