d

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
naray23
Date:
Mon Aug 21 04:45:23 2017 +0000
Commit message:
None

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Aug 21 04:45:23 2017 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+
+
+#define CUTOFF_MAX_VLTG  20000  //approx 1V
+#define CUTOFF_MIN_VLTG  15000  //approx 0.5V
+
+DigitalOut myled(LED_GREEN);
+DigitalOut SwitchControl(PTD4,0);
+Serial pc(USBTX, USBRX);
+AnalogIn   ain(A0);
+
+int main()
+{
+   unsigned int batteryvltg=0;
+   SwitchControl=0;
+   pc.printf("Started Charging\n\r");
+   pc.baud(9600);
+    while (true) 
+    {
+        SwitchControl =1;
+        while(batteryvltg < 12000)
+        {
+            batteryvltg = ain.read_u16();
+            //printf("%u \n\r", batteryvltg);
+            wait(0.01);
+        }
+        while(batteryvltg < 20000)
+        {
+            batteryvltg = ain.read_u16();
+            printf("%u \n\r", batteryvltg);
+            wait(0.01);
+        }
+        //pc.printf("Cutoff point Reached\n\r");
+        SwitchControl =0;
+        batteryvltg = ain.read_u16();
+        while(batteryvltg > 18500)
+        {
+            printf("%u \n\r", batteryvltg);
+            batteryvltg = ain.read_u16();
+            wait(0.0001);
+      
+        }
+        while(batteryvltg > 15000)
+        {
+            printf("%u \n\r", batteryvltg);
+            batteryvltg = ain.read_u16();
+            wait(0.0001);
+      
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Aug 21 04:45:23 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file