For coursework of group 3 in SOFT564Z

Dependencies:   Motordriver ros_lib_kinetic

Revision:
3:7da9888ac8dc
Parent:
2:b9a495b330fd
Child:
4:8afc50a3e4ac
--- a/Battery_Monitor.cpp	Thu Nov 28 13:04:30 2019 +0000
+++ b/Battery_Monitor.cpp	Thu Nov 28 13:36:44 2019 +0000
@@ -1,25 +1,19 @@
-#include "mbed.h"
+#include "Battery_Monitor.hpp"
+#include "General.hpp"
 
+Ticker BattCheck;
 AnalogIn v_bat(PB_1);
 AnalogIn v_5(PC_2);
 AnalogIn v_3(PF_4);
-//A2 and A3 for top and base battery charges respectively
-//cut off voltage at 3.3v or higher - technical max is 4.2v,
-//but there is no built-in hardware cutoff!
-
-//MON_VBATT PB_1
-//MON_5V0   PC_2
-//MON_3V3   PF_4
 
 void battCheck(void);
 
-Ticker t1;
-Serial pc(USBTX, USBRX);
-
-int main() {
-    t1.attach(&battCheck, 1.0);
-    while(1) {
-        //Do shit
+void initBattCheck(void)
+{
+BattCheck.attach(&battCheck, 1.0);
+    while(1)
+    {
+        Thread::wait(500);
     }
 }
 
@@ -28,5 +22,5 @@
     float analogue5V = v_5.read();
     float analogue33V = v_3.read();
     float analogueValue = v_bat.read();
-    pc.printf("Voltage readings are: VBATT: %f 5V0: %f 3V3: %f\n\r", analogueValue, analogue5V, analogue33V);
+    //.printf("Voltage readings are: VBATT: %f 5V0: %f 3V3: %f\n\r", analogueValue, analogue5V, analogue33V);
 }
\ No newline at end of file