mm4_encoder_testing

Dependencies:   QEI mbed-src-AV

Files at this revision

API Documentation at this revision

Comitter:
jliu
Date:
Wed Nov 11 00:23:33 2015 +0000
Parent:
1:1fed86c424fd
Commit message:
k

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Nov 08 01:35:36 2015 +0000
+++ b/main.cpp	Wed Nov 11 00:23:33 2015 +0000
@@ -3,6 +3,11 @@
 // Control with PWM.
 // Test Serial Output.
 
+////////////////
+//SOME GLOBALS//
+////////////////
+int turn_dist = 1000;
+
 
 #include "mbed.h"
 #include "PinDefinitions.h"
@@ -56,8 +61,8 @@
 
 void goForward(int dist)
 {
-    setRightPwm(0.5);
-    setLeftPwm(0.45);
+    setRightPwm(1);
+    setLeftPwm(0.95);
     while (Rdistance() < dist && Ldistance() < dist)
     {
         pc.printf("Lp: %d\nRp: %d\n\n", Ldistance(), Rdistance());
@@ -69,10 +74,8 @@
 }
 
 void turnR()
-{
-    const int turn_dist = 1000;
-    
-    setLeftPwm(0.5);
+{   
+    setLeftPwm(1);
     while(Ldistance() < turn_dist)
     {
         pc.printf("Turning... Lp: %d\n", Ldistance());
@@ -83,10 +86,8 @@
 }
 
 void turnL()
-{
-    const int turn_dist = 1000;
-    
-    setRightPwm(0.5);
+{    
+    setRightPwm(1);
     while(Rdistance() < turn_dist)
     {
         pc.printf("Turning... Rp: %d\n", Rdistance());