Example program to demonstrate the use of the BatteryGaugeBQ27441 class.
Dependencies: battery-gauge-bq27441
Diff: main.cpp
- Revision:
- 8:ea7defa37e8a
- Parent:
- 7:9ccf046018f7
--- a/main.cpp Mon Jul 31 10:30:28 2017 +0100 +++ b/main.cpp Mon Apr 09 17:03:36 2018 +0500 @@ -93,6 +93,14 @@ ledRed = 0; wait_ms(1000); } + + if (gauge.getPower(&reading)) { + printf("Power consumption : %.3f W.\n", ((float) reading) / 1000); + } else { + ledGreen = 1; + ledRed = 0; + wait_ms(1000); + } } else { printf("Battery gauge could not be enabled.\n");