Example program to demonstrate the use of the BatteryGaugeBQ27441 class.

Dependencies:   battery-gauge-bq27441

Files at this revision

API Documentation at this revision

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
--- 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
--- 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");