The Chenne Robot

Dependencies:   Encoder HIDScope MODSERIAL QEI biquadFilter mbed

Files at this revision

API Documentation at this revision

Comitter:
ThomasBNL
Date:
Tue Oct 20 20:06:32 2015 +0000
Parent:
67:65750d716788
Child:
69:22bf29479473
Commit message:
main function cleaned up put action controller inside void

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Oct 20 20:01:10 2015 +0000
+++ b/main.cpp	Tue Oct 20 20:06:32 2015 +0000
@@ -245,7 +245,10 @@
                 
 void red();void blue();void green();void white();void yellow();void cyan();void purple(); void black();  // DEBUG: Different color LEDS
 
-void calibrate_potmeter(); // DEBUG/TEST: Calibration thresholds with potmeter
+void calibrate_potmeter();          // DEBUG/TEST : Calibration thresholds with potmeter
+
+void Action_Controller();           // CONTROLLER : Decides and executes if the robot needs to turn to the left, right or strike based on the currently measured EMG signal
+    
 //============================================================================================================================
                                            ///////////////////////////////
                                            //                           //
@@ -275,7 +278,21 @@
     
     green();                                                   // START CONTROLLOOP (GREEN LED)
    
-    
+    Action_Controller();                                       // CONTROLLER : Decides and executes if the robot needs to turn to the left, right or strike based on the currently measured EMG signal
+      
+}
+
+//============================================================================================================================
+                                           ///////////////////////////////
+                                           //                           //
+/////////////////////////////////////////////   [FUNCTIONS DESCRIBED]   /////////////////////////////////////////////////////
+                                           //                           //                                                                        
+                                           ///////////////////////////////                                                                        
+//============================================================================================================================
+
+
+    void Action_Controller()
+    {
     while(1) 
         {                                                                                                   // Start while loop           
         while(looptimerflag != true);
@@ -446,28 +463,8 @@
                             }
                     }
             }
-
-//                                         ___________________________
-//                                       //                           \\
-//                                      ||         [HIDSCOPE]          ||
-//                                       \\___________________________//
-//                                      // Check signals inside HIDSCOPE \\
-        
-            //scope.set(0,error_turn);        // HIDSCOPE channel 0 : Current Error
-            //scope.set(1,position_turn);     // HIDSCOPE channel 1 : Position_turn
-            //scope.set(2,pwm_to_motor_turn); // HIDSCOPE channel 2 : Pwm_to_motor_turn
-            //scope.send();                   // Send channel info to HIDSCOPE
-            
-}
-}
-
-//============================================================================================================================
-                                           ///////////////////////////////
-                                           //                           //
-/////////////////////////////////////////////   [FUNCTIONS DESCRIBED]   /////////////////////////////////////////////////////
-                                           //                           //                                                                        
-                                           ///////////////////////////////                                                                        
-//============================================================================================================================
+            }
+            }
 
 //                                         ___________________________
 //                                       //                           \\
@@ -941,4 +938,5 @@
         Threshold_Bicep_Left_2  =((EMG_L_max-EMG_L_min)*0.6)+EMG_L_min;      //(waarde waarop het gemeten EMG signaal 60% van max het maximale is); 
         Threshold_Bicep_Right_1 =((EMG_R_max-EMG_R_min)*0.2)+EMG_R_min;     //(waarde waarop het gemeten EMG signaal 20% van max het maximale is); // RIGHT
         Threshold_Bicep_Right_2 =((EMG_R_max-EMG_R_min)*0.6)+EMG_R_min;     //(waarde waarop het gemeten EMG signaal 60% van max het maximale is);
-    }
\ No newline at end of file
+    }
+    
\ No newline at end of file