Used for testing battery sense circuit, looking for max and min levels. Allow for finding true empty, half and full values for driving LEDs for example
Dependencies: mbed MPL3115A2 TSI WiGo_BattCharger
Revision 2:c08efa9effc8, committed 2013-05-17
- Comitter:
- monpjc
- Date:
- Fri May 17 20:13:32 2013 +0000
- Parent:
- 1:b1921e153d21
- Child:
- 3:3b88d6ae24f2
- Commit message:
- Added Light Sensor
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiGo_AmbLight.lib Fri May 17 20:13:32 2013 +0000 @@ -0,0 +1,1 @@ +WiGo_AmbLight#be6163c66a11
--- a/WiGo_BattCharger.lib Fri May 17 10:42:54 2013 +0000 +++ b/WiGo_BattCharger.lib Fri May 17 20:13:32 2013 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/monpjc/code/WiGo_BattCharger/#d52ea6d270c0 +http://mbed.org/users/monpjc/code/WiGo_BattCharger/#f52adda183d2
--- a/main.cpp Fri May 17 10:42:54 2013 +0000 +++ b/main.cpp Fri May 17 20:13:32 2013 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" #include "WiGo_BattCharger.h" +#include "WiGo_AmbLight.h" #define RGB_LED_ON 0 #define RGB_LED_OFF 1 @@ -11,15 +12,16 @@ Serial pc(USBTX, USBRX); WiGo_BattCharger Batt( BATT_LOW, BATT_MED, BATT_FULL, CHRG_EN1, CHRG_EN2, CHRG_SNS_EN, CHRG_SNS, CHRG_POK, CHRG_CHG); +WiGo_AmbLight Light( AMBLIGHT_EN, AMBLIGHT_LVL); float max_batt; float batt_lvl; int main() { - Batt.init(); + Batt.init(CHRG_500MA); Batt.sense_en(1); - + Light.en(1); wait(0.5); max_batt = Batt.read(); @@ -48,13 +50,13 @@ wait(0.9); } - Batt.LEDupdate(); + Batt.LEDupdate(1); batt_lvl = Batt.read(); if( batt_lvl > max_batt ) { max_batt = batt_lvl; } - pc.printf(">%f Max:%f\n\r", batt_lvl, max_batt); + pc.printf(">%f Max:%f %i %i\n\r", batt_lvl, max_batt, Batt.level(), Light.level()); } }