The total controller!

Dependencies:   EMG1 PIDController1 compute mbed InBetweenController PinDetect QEI

Revision:
23:174f955e5c15
Parent:
22:c6459c435069
diff -r c6459c435069 -r 174f955e5c15 main.cpp
--- a/main.cpp	Thu Nov 05 10:47:06 2015 +0000
+++ b/main.cpp	Thu Nov 05 12:22:57 2015 +0000
@@ -4,6 +4,7 @@
 #include "pidControl.h"
 #include "PinDetect.h"
 #include "compute.h"
+#include "main.h"
  
 /// Define Objects
 Ticker      sample_timer;
@@ -20,13 +21,20 @@
 double      emg_out0, emg_out1, emg_out2;
 bool        demoing = false;
 int         demoInt = 0;
+int         demoRound = 0;
  
 void tick()
 {
     if(demoing) {
+        if(demoRound == 7) {
+            NVIC_SystemReset();
+            return;   
+        }
         double a,b;
-        if(demoInt == 0)
+        if(demoInt == 0) {
             Point2Angles(-20, 18, a, b);
+            demoRound++;
+        }
         if(demoInt == 1)
             Point2Angles(-20, 35, a, b);
         if(demoInt == 2)
@@ -36,6 +44,12 @@
         demoInt++;
         demoInt = demoInt%4;
         rotate(a,b);
+        if(demoRound == 6) {
+            Point2Angles(0, 24, a, b);
+            demoRound++;
+            rotate(a,b);
+            return;
+        }
         return;  
     }
     double a,b,x,y;
@@ -147,6 +161,12 @@
     movement_timer.attach(&goMotor, 0.01f);
  
     rotate(a,b);
+    
+    /* COMMENT THIS TO USE THE EMG */
+    calibrated = 4;
+    calc_timer.attach(&goTick, 2.0);
+    demoing = true;  
+    /* COMMENT THIS TO USE THE EMG */
  
     /** The main while-loop */
     while(1) {