Example program to demonstrate the use of the BatteryGaugeBQ27441 class.
Dependencies: battery-gauge-bq27441
Revision 8:ea7defa37e8a, committed 2018-04-09
- Comitter:
- Bilal Qamar
- Date:
- Mon Apr 09 17:03:36 2018 +0500
- Parent:
- 7:9ccf046018f7
- Commit message:
- Updated library to the latest commit resolving current=0 issue
Changed in this revision
battery-gauge-bq27441.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9ccf046018f7 -r ea7defa37e8a battery-gauge-bq27441.lib --- a/battery-gauge-bq27441.lib Mon Jul 31 10:30:28 2017 +0100 +++ b/battery-gauge-bq27441.lib Mon Apr 09 17:03:36 2018 +0500 @@ -1,1 +1,1 @@ -https://mbed.org/teams/ublox/code/battery-gauge-bq27441/#63b325f2c21a +https://mbed.org/teams/ublox/code/battery-gauge-bq27441/#998cc334f8f2
diff -r 9ccf046018f7 -r ea7defa37e8a main.cpp --- 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");