Janus Bo Andersen / Mbed 2 deprecated PRO1_amp_test

Dependencies:   mbed m3pi

Revision:
2:41af46339652
Parent:
1:fbf9b4ab4bc5
Child:
3:783382bcf2ec
--- a/main.cpp	Wed Nov 21 11:40:35 2018 +0000
+++ b/main.cpp	Fri Nov 30 12:10:05 2018 +0000
@@ -62,144 +62,33 @@
     DigitalOut myled4 (LED4);
     
     
-    // Set all LEDs to off
-    redled1 = 0;
-    redled2 = 0;
-    redled3 = 0;
-    redled4 = 0;
-    redled5 = 0;
-    redled6 = 0;
-    redled7 = 0;
-    redled8 = 0;
-    myled1 = 0;
-    myled2 = 0;
-    myled3 = 0;
-    myled4 = 0;
+    // Set all LEDs to on
+    redled1 = 1;
+    redled2 = 1;
+    redled3 = 1;
+    redled4 = 1;
+    redled5 = 1;
+    redled6 = 1;
+    redled7 = 1;
+    redled8 = 1;
+    myled1 = 1;
+    myled2 = 1;
+    myled3 = 1;
+    myled4 = 1;
     
     
     //Initialize the car
-    m3pi.sensor_auto_calibrate();
-
-    // create some control variables
-    float right;
-    float left;
-    float current_pos_of_line = 0.0;
-    float previous_pos_of_line = 0.0;
-    float derivative,proportional,integral = 0;
-    float power;
-    float speed = OPTIMAL_SPEED;
-    
+    m3pi.sensor_auto_calibrate();   
     
     // Start the loop
     while (1) {
-    
-    // Get the position of the line.
-    current_pos_of_line = m3pi.line_position();        
-    proportional = current_pos_of_line;
-    
-    // Compute the derivative
-    derivative = current_pos_of_line - previous_pos_of_line;
-    
-    // Compute the integral
-    integral += proportional;
-    
-    // Remember the last position.
-    previous_pos_of_line = current_pos_of_line;
-    
-    // Compute the power
-    power = (proportional * (P_TERM) ) + (integral*(I_TERM)) + (derivative*(D_TERM)) ;
-    
-    // Compute new speeds   
-    right = speed+power;
-    left  = speed-power;
-    
-    // limit checks
-    if (right < MIN)
-        right = MIN;
-    else if (right > MAX)
-        right = MAX;
-        
-    if (left < MIN)
-        left = MIN;
-    else if (left > MAX)
-        left = MAX;
-        
-   // set speed 
-    m3pi.left_motor(left);
-    m3pi.right_motor(right);
-    
-    print_battery();
-
-}
-    
+          
+   // set full speed 
+    m3pi.left_motor(1.0);
+    m3pi.right_motor(1.0);
     
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        
-        /*
-        f = m3pi.battery();
-        if (f > 4.7) {
-            myled1 = 1;
-        } else {
-            myled1 = 0;
-        }
-        
-        
-        m3pi.cls();
-        m3pi.locate(0,0);
-    
-        //convert to a string
-        sprintf(text, "%4.2f", f);
-        m3pi.printf(text);
-        wait(0.2);
-        */
-          
-      
-}
+    //print voltage
+    print_battery();
+    }
 
-
-
-/* Structure
-
-functions:
-
-Charging Strategy
-poll voltage -> return voltage
-Charging limits
-Low Batt level
-Enough charge level
-
-Control -> inherits from m3pi
-pause line follower
-resume line follower
-speed up (home stretch)
-
-
-Class: CarData
-
-
-Class: PitData
-Total time in pit
-Total stops in pit
-
-Methods:
-Update Wh
-Update pit stops
-Print pitstops to screen
-
-
-
-
-
-*/
\ No newline at end of file
+}
\ No newline at end of file