Driver for controlling Renishaw RenBuggy

Dependencies:   SevenSegmentDisplay DCMotorDrive mbed MotorController

Revision:
4:64d065d6d072
Parent:
3:0dd99309381e
--- a/main.cpp	Wed Jan 15 11:51:19 2014 +0000
+++ b/main.cpp	Tue Jan 21 13:38:04 2014 +0000
@@ -17,7 +17,7 @@
 // + FLASH: causes the display to flash
 SevenSegmentDisplay segmentled( FADE );
 
-MotorController RenBuggy(p5, p7, p6, p8);
+MotorController RenBuggy(p5, p7, p9, p6, p8, p10);
 DigitalIn LFast(p9), LSlow(p12), RFast(p15), RSlow(p18);
 
 void attimeout();            //declare prototype for timeout handler.
@@ -34,6 +34,7 @@
     timeout.attach(&attimeout, 3);
 //    LeftMotor.SetMotorPwmAndRevolutions(18000,32);
 
+    RenBuggy.Forwards(100);
 
     for(;;) {
     } // Loop forever (the program uses interrupts)
@@ -41,37 +42,13 @@
 
 void attimeout()
 {
-    int MotorConv = 0;
     static int Flip = 0;
-    
-    if ((RFast == 0) && (u16RightSpeed < PWM_PERIOD * 1000))
-    {
-        u16RightSpeed += 15;
-//        RightMotor.SetMotorPwm(u16RightSpeed);
-    }
-    if ((RSlow == 0) && (u16RightSpeed > 0))
-    {
-        u16RightSpeed -= 15;
-//        RightMotor.SetMotorPwm(u16RightSpeed);
-    }
-    if ((LFast == 0) && (u16LeftSpeed < PWM_PERIOD * 1000))
-    {
-        u16LeftSpeed += 15;
-//        LeftMotor.SetMotorPwm(u16LeftSpeed);
-    }
-    if ((LSlow == 0) && (u16LeftSpeed > 0))
-    {
-        u16LeftSpeed -= 15;
-//        LeftMotor.SetMotorPwm(u16LeftSpeed);
-    }
-    // Updates display with new values.
+
     if (Flip++ == 0)
-        MotorConv = RenBuggy.LeftReadOdometer();
+        segmentled.DisplayInt(RenBuggy.ReadLeftOdometer());
     else
     {
-        MotorConv = RenBuggy.RightReadOdometer();
+        segmentled.DisplayInt(RenBuggy.ReadRightOdometer());
         Flip = 0;
     }
-    //MotorConv = RenBuggy.LeftReadOdometer();
-    segmentled.DisplayInt(MotorConv);
 }
\ No newline at end of file