Final Project files for mBed development.

Dependencies:   m3pi mbed

Files at this revision

API Documentation at this revision

Comitter:
chstrchu
Date:
Tue Dec 09 21:18:07 2014 +0000
Parent:
30:3211e2962441
Child:
32:8b589710632b
Commit message:
revisions

Changed in this revision

main.c Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.c	Tue Dec 09 01:56:03 2014 +0000
+++ b/main.c	Tue Dec 09 21:18:07 2014 +0000
@@ -40,7 +40,6 @@
     pi.printf("Ready");
     pi.locate(0,1);
     pi.printf("%f mV", pi.battery());
-    wait(.5);
     pi.sensor_auto_calibrate();
     
     wait(1);
@@ -67,7 +66,8 @@
     } else {
         return 1;
     }
-    right(180);
+    left(180);
+    
     Timer caltimer;
     caltimer.start();
     do {
@@ -197,10 +197,10 @@
         if (angle >= 360) {
             angle -= 360;
         }
-        //pi.cls();
-        //pi.locate(0,0);
-        //pi.printf("a:%f", delta_a);
-        //timerWait(1.5);
+        pi.cls();
+        pi.locate(0,0);
+        pi.printf("a:%f", delta_a);
+        timerWait(1.5);
         left(delta_a);
 
         /* Put pen into position. */
@@ -215,10 +215,10 @@
         if (dist < 0) {
             dist *= -1;
         }
-        //pi.cls();
-        //pi.locate(0,0);
-        //pi.printf("d:%f", 0.4*cal_time*(dist/(double)dim_x));
-        //timerWait(1.5);
+        pi.cls();
+        pi.locate(0,0);
+        pi.printf("d:%f", 0.4*cal_time*(dist/(double)dim_x));
+        timerWait(1.5);
         forward(0.4*cal_time*(dist/(double)dim_x));
 
         last_x = x;
--- a/main.h	Tue Dec 09 01:56:03 2014 +0000
+++ b/main.h	Tue Dec 09 21:18:07 2014 +0000
@@ -21,7 +21,7 @@
 #define ERR_SUCCESS 0
 #define ERR_FAILURE 1
 #define DRIVE_RATE  1/50
-#define TIME_FACT 1820
+#define TIME_FACT 1780
 #define CAL_SPEED .1
 #define CLOSE_ENOUGH .0008