Final Project files for mBed development.

Dependencies:   m3pi mbed

Files at this revision

API Documentation at this revision

Comitter:
lsaristo
Date:
Sun Nov 16 05:26:24 2014 +0000
Parent:
10:94b068b2ce1d
Child:
12:1aa6b8a74136
Commit message:
Moved all robot functions to robot_loop()

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
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/control.c	Sat Nov 15 23:03:06 2014 +0000
+++ b/control.c	Sun Nov 16 05:26:24 2014 +0000
@@ -12,6 +12,7 @@
 #include "main.h"
 extern m3pi pi;
 extern DigitalIn start_button;
+extern DigitalOut oled_2;
 
 void get_ps_file(char* moves)
 {
@@ -28,6 +29,24 @@
 void robot_loop()
 {    
     start:
+    pi.cls();
+    pi.locate(0,0);
+    pi.printf("PiCO");
+    pi.locate(0,1);
+    pi.printf("%f mV", pi.battery());
+    wait(.5);
+    while(start_button) {
+        oled_2 = 1;
+        wait(.5);
+        pi.locate(0,0);
+        pi.printf("Ready");
+        oled_2 = 0;
+    }
+    pi.cls();
+    pi.locate(0,0);
+    pi.printf("GO!");
+    wait(.5);
+
     while(1) {
         if(start_button) {
             pi.stop();
--- a/main.c	Sat Nov 15 23:03:06 2014 +0000
+++ b/main.c	Sun Nov 16 05:26:24 2014 +0000
@@ -45,22 +45,6 @@
     //
     // Basic setup information
     start_button.mode(PullUp);
-    
-    pi.locate(0,0);
-    pi.printf("PiCO");
-    pi.locate(0,1);
-    pi.printf("%f mV", pi.battery());
-    wait(.2);
-    while(!start_button) {
-        oled_2 = 1;
-        wait(.2);
-        pi.locate(0,0);
-        pi.printf("Ready");
-        oled_2 = 0;
-    }
-    pi.locate(0,0);
-    pi.printf("GO!");
-    wait(.2);
 
     //
     // Main program loop.
--- a/main.h	Sat Nov 15 23:03:06 2014 +0000
+++ b/main.h	Sun Nov 16 05:26:24 2014 +0000
@@ -14,7 +14,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #define TURN_SPEED  0.25
-#define DRIVE_SPEED 0.5
+#define DRIVE_SPEED 0.25
 #define ERR_SUCCESS 0
 #define ERR_FAILURE 1
 #define DRIVE_RATE  1/50