Alpha Tango / Mbed 2 deprecated R5_Robotics

Dependencies:   mbed

Revision:
2:5f29bc7daa49
Parent:
1:4ab886b72870
Child:
3:d3264a6f7a62
--- a/main.cpp	Fri Mar 16 20:50:41 2018 +0000
+++ b/main.cpp	Sat Mar 24 18:04:21 2018 +0000
@@ -46,13 +46,14 @@
 void grabToken();//Picks up the token for reading
 void dropToken();//Drops the token off
 void kill(); 
+void turnLeft(int, bool);
 //void rot90(); //Rotates the robot 90 degrees to the left
 //void rot180(); //Turns the robot around
 
     const int FORWARD = 0;
     const int BACKWARD = 1;
     const float stepSize = 0.001212; //in meters
-    const float FREQUENCY = 500; //dist per second
+    const float FREQUENCY = 500; //steps per second
 
 
 
@@ -135,9 +136,20 @@
         magArm.period(0); 
         magArm.write(0);    
 }
-void rot90() 
-{
-       
+void turnLeft(int dist, bool direction)
+{ 
+    //Get rid of all FR occurences which will turn right motor off
+    FLdirection = direction;    //to turn left we want this going FORWARD so a 0;
+                                
+    
+    stepFL.period(1/FREQUENCY); 
+    stepFL.write(0.5); 
+    
+    //dist/stepSize is the number of steps
+    //1/FREQUENCY is the time per step
+    wait((dist/stepSize)*(1/FREQUENCY));
+    stepFL.period(0);
+    stepFL.write(0);
 }
 void rot180()
 {