TRR2018 omar

Dependencies:   mbed

Fork of biniou by TRR 2018

Revision:
23:04d393220daa
Parent:
11:bc24b3ba51a9
Child:
27:f8c3f1524a64
--- a/main.cpp	Sat Sep 15 15:56:01 2018 +0000
+++ b/main.cpp	Sun Sep 16 15:04:41 2018 +0000
@@ -1,34 +1,42 @@
 #include "stateMachines.h"
+Timer timerLoop;
 
 int main()
 {
-
-mursInit();
+    mursInit();
 #ifdef DLVV
-obstacleInit();
-#endif 
-sectionInit();  
-maxSpeedInit();
-throttleInit(); 
+    obstacleInit();
+#endif
+    sectionInit();
+    maxSpeedInit();
+    throttleInit();
+    timerLoop.start();
+    while (1) {
 
+        if(timerLoop.read_us()>40000) { // output every ms
+            timerLoop.reset();
+            timerLoop.start();
+            mursUpdate();
+#ifdef DLVV
+            obstacleUpdate();
+#endif
+        }
+        sectionUpdate();
+        maxSpeedUpdate();
+        throttleUpdate();
 
 
-    while (1) {
-       
-        mursUpdate();
-        #ifdef DLVV
-        obstacleUpdate();
-        #endif
-        sectionUpdate(); 
-        maxSpeedUpdate();
-        throttleUpdate();
-       
         mursOutput();
-        #ifdef DLVV 
+#ifdef DLVV
         obstacleOutput();
-        #endif
-        sectionOutput(); 
+#endif
+        sectionOutput();
         maxSpeedOutput();
-        throttleOutput(); 
+        throttleOutput();
+
+#ifdef SAMPLING
+    sampleLog();
+#endif
+
     }
 }
\ No newline at end of file