Mine, not yours justin

Dependencies:   HMC6352 USBHost mbed-rtos mbed

Fork of Project by Justin Eng

Revision:
1:41cee26b35cc
Parent:
0:b6fd1c37944a
Child:
2:56eb726bdb0d
--- a/RobotControl.h	Fri Apr 11 17:40:07 2014 +0000
+++ b/RobotControl.h	Fri Apr 11 17:54:21 2014 +0000
@@ -5,7 +5,7 @@
 #include "HMC6352.h"
 
 //Gyro
-HMC6532 compass(p28, p27);
+HMC6352 compass(p28, p27);
 
 //H-bridge
 PwmOut rightMotorPWM(p21);  //Channel A
@@ -33,14 +33,26 @@
     rightMotorPWM = 0;
     leftMotorPWM = 0;
     leftMotor1 = 0;
-    leftMotor2 = 0;
-    rightMotor1 = 0;
+    leftMotor2 = 1;
+    rightMotor1 = 1;
     rightMotor2 = 0;
 }
 
-//Need compass module
+//These functions are not completed yet...
 void gyroDriveStraight(float speed, bool reverse);
-void centerTurnLeft(int delta_degrees);
+void centerTurnLeft(int delta_degrees) {
+    double initial = compass.sample() / 10;
+    while ((compass.sample() / 10) > initial - delta_degrees){
+        //Set speed
+        rightMotorPWM = 0.8;
+        leftMotorPWM = 0.8;
+        leftMotor1 = 1;
+        leftMotor2 = 0;
+        rightMotor1 = 1;
+        rightMotor1 = 0; 
+    }
+    stop();
+}
 void centerTurnRight(int delta_degrees);
 void driveTurnLeft(int delta_degrees);
 void driveTurnRight(int delta_degrees);