A simple serial test program for the MAX17048 library.

Dependencies:   MAX17048 mbed

Files at this revision

API Documentation at this revision

Comitter:
neilt6
Date:
Mon Sep 16 22:04:00 2013 +0000
Parent:
2:fbf5cabf5658
Child:
4:b1682accf590
Commit message:
Improved example to make use of float override

Changed in this revision

MAX17048.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/MAX17048.lib	Fri Aug 30 16:00:43 2013 +0000
+++ b/MAX17048.lib	Mon Sep 16 22:04:00 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/neilt6/code/MAX17048/#32087cca331f
+http://mbed.org/users/neilt6/code/MAX17048/#e61b2723d2cf
--- a/main.cpp	Fri Aug 30 16:00:43 2013 +0000
+++ b/main.cpp	Mon Sep 16 22:04:00 2013 +0000
@@ -10,16 +10,13 @@
         printf("Device detected!\n");
 
         while (1) {
-            //Read the cell voltage
-            float vcell = gauge.vcell();
-
-            //Print the cell voltage
-            printf("Vcell = %f\n", vcell);
+            //Print the current state of charge
+            printf("SOC = %f%%\n", (float)gauge);
 
             //Sleep for 0.5 seconds
             wait(0.5);
         }
     } else {
-        printf("Device not detected!\n");
+        error("Device not detected!\n");
     }
 }