Group 9 BioRobotics / Mbed 2 deprecated the_code

Dependencies:   HIDScope Servo mbed QEI biquadFilter

Revision:
33:a03bb006dff4
Parent:
32:fad4b119dce0
Child:
34:23eedc10a4f7
diff -r fad4b119dce0 -r a03bb006dff4 THE.cpp
--- a/THE.cpp	Fri Nov 02 11:41:41 2018 +0000
+++ b/THE.cpp	Fri Nov 02 15:29:56 2018 +0000
@@ -177,7 +177,7 @@
 volatile double Trans_prev_error = 0.0;
 
 // States
-enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING, DEMO}; // states the robot can be in
+enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING}; // states the robot can be in
 states CurrentState = WAIT; // the CurrentState to start with is the WAIT state
 bool StateChanged = true; // the state must be changed to go into the next state
 
@@ -757,22 +757,6 @@
     pwmpin_2 = fabs (pwm1);
     }   
 
-// DEMO
-// To control the robot with a written code and write 'HELLO'
-// Voor het laatst bewaren
-
-// DEMO
-// Executing demo mode, drawing a square
-void demo_mode()
-{
-    translation_start(0,0.9);
-    rotation_start(0,0.7); 
-    wait(1);
-    translation_stop();
-    rotation_stop();
-}
-
-
 // FAILURE
 // To shut down the robot after an error etc 
 void failure_mode()
@@ -804,6 +788,8 @@
     process_tick.attach(&processing_emg,T); // EMG signals must be filtered all the time! EMG signals filtered every T sec.
     emergency.attach(&failure_mode,0.01); // To make sure you can go to emergency mode all the time
     
+    pc.printf("State is WAIT\r\n");
+    
     while(true){
         // timer
         clock_t start; // start the timer
@@ -811,9 +797,6 @@
         time_overall = (clock() - start) / (double) CLOCKS_PER_SEC;
         myservo = 0.1; // Keep the pen lifted until servo function is called (operation mode)
         
-        //pc.printf("potmeter value = %f ", potmeter_value);
-        //pc.printf("counts = %i\r\n", counts); 
-        
         // With the help of a switch loop and states we can switch between states and the robot knows what to do
         switch(CurrentState)
         {
@@ -823,7 +806,6 @@
             
             if(StateChanged) // so if StateChanged is true
             {
-                pc.printf("\r\nState is WAIT\r\n");
                 // Execute WAIT mode
                 wait_mode();
                 
@@ -914,14 +896,7 @@
                     if(button_wait == false) // condition OPERATING --> WAIT; button_wait press  
                     {
                         CurrentState = WAIT;
-                        g = false;
-                        break;
-                        }
-                    
-                    if(button_demo == false) // condition OPERATING --> DEMO; button_demo press
-                    {
-                        CurrentState = DEMO;
-                        pc.printf("\r\nState is DEMO\r\n");
+                        pc.printf("\r\nState is WAIT\r\n");
                         g = false;
                         break;
                         }
@@ -933,26 +908,6 @@
                 }
             
             break;
-            
-            case DEMO:
-            
-            StateChanged = true;
-            
-            if(StateChanged)
-            {
-                // execute demo mode
-                demo_mode();
-                
-                StateChanged = false;
-                }
-                
-            if(button_wait == false) // condition OPERATING --> WAIT; button_wait press  
-            {
-                CurrentState = WAIT;
-                StateChanged = false;
-                }
-                
-            break;
         
             // no default  
             }