Final Project files for mBed development.

Dependencies:   m3pi mbed

Revision:
18:eab7b0e89398
Parent:
17:c72c092fcdf7
Child:
19:47759cf4f9b9
--- a/main.c	Mon Dec 01 00:41:04 2014 +0000
+++ b/main.c	Mon Dec 01 01:02:42 2014 +0000
@@ -189,9 +189,12 @@
     // Main program loop.
     // robot_loop();
     size_t bytes_read = 0;
-    int err, x, y, last_x, last_y;
+    int err, x, y, last_x, last_y, delta_x, delta_y;
     int offset = 0;
     char *cur, *next;
+    float angle, theta;
+    angle = 0;
+    theta = 0;
     ps_file = fopen("/local/test.ps", "r");
     /* PS parsing loop. */
     while (1) {
@@ -203,7 +206,11 @@
         cur = instbuf;
         while (cur[0] != '\0') {
             err = retrieve_inst(instbuf, &x, &y, &draw);
-            move(x, y, draw);
+            delta_x = x-last_x;
+            delta_y = y-last_y;
+            theta = tan(delta_x/delta_y);
+            theta *= 57.2957795;
+            delta_a = theta-angle;
             last_x = x;
             last_y = y;
             next = strchr(cur, '\n');
@@ -217,6 +224,8 @@
     }
     //
     // We should never reach this point!
+    //
+    // Yes, we should...
     return 0;
 }