Final Project files for mBed development.

Dependencies:   m3pi mbed

Files at this revision

API Documentation at this revision

Comitter:
John Wilkey
Date:
Thu Nov 13 00:00:14 2014 -0500
Parent:
5:01882c3de2dc
Child:
7:6e5cc24e1ce7
Commit message:
Untested additions to skelton

Changed in this revision

control.c Show annotated file Show diff for this revision Revisions of this file
main.c Show annotated file Show diff for this revision Revisions of this file
project.h Show annotated file Show diff for this revision Revisions of this file
--- a/control.c	Wed Nov 12 23:48:26 2014 -0500
+++ b/control.c	Thu Nov 13 00:00:14 2014 -0500
@@ -10,6 +10,7 @@
 
 int forward(float amt, float spd)
 {
+    if(amt > 1) { spd = 1; }
     pi.forward(spd);
     wait(amt);
     return EXIT_SUCCESS;
@@ -17,6 +18,7 @@
 
 int backward(float amt, float spd)
 {
+    if(amt > 1) { spd = 1; }
     pi.backward(spd);
     wait(amt);
     return EXIT_SUCCESS;
--- a/main.c	Wed Nov 12 23:48:26 2014 -0500
+++ b/main.c	Thu Nov 13 00:00:14 2014 -0500
@@ -21,5 +21,15 @@
 int main()
 {
     pretty_print("PiCO");
-    return EXIT_SUCCESS;
+
+    while(1) {
+        wait(2);
+        forward(10, DRIVE_SPEED);
+        wait(2);
+        backward(10, DRIVE_SPEED);
+    }
+
+    //
+    // Our code should NEVER reach this point. 
+    return EXIT_FAILURE;
 }
--- a/project.h	Wed Nov 12 23:48:26 2014 -0500
+++ b/project.h	Thu Nov 13 00:00:14 2014 -0500
@@ -12,6 +12,7 @@
 #include "mbed.h"
 #include "m3pi.h"
 #define TURN_SPEED 0.25
+#define DRIVE_SPEED 0.5
 #define ERR_SUCCESS 0
 #define ERR_FAILURE 1