Mircroprocessor revised code 9/22

Dependencies:   m3pi mbed

Fork of m3pi_HelloWorld by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
SpicedPork
Date:
Thu Sep 18 18:55:58 2014 +0000
Parent:
7:d0689e8f23bf
Child:
9:b723c1cdaae4
Commit message:
rev

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri May 13 10:51:57 2011 +0000
+++ b/main.cpp	Thu Sep 18 18:55:58 2014 +0000
@@ -1,23 +1,30 @@
-#include "mbed.h"
-#include "m3pi.h"
-
-m3pi m3pi;
-
-int main() {
-
-    m3pi.locate(0,1);
-    m3pi.printf("LO World");
-
-    wait (2.0);
-
-    m3pi.forward(0.5); // Forward half speed
-    wait (0.5);        // wait half a second
-    m3pi.left(0.5);    // Turn left at half speed
-    wait (0.5);        // wait half a second
-    m3pi.backward(0.5);// Backward at half speed 
-    wait (0.5);        // wait half a second
-    m3pi.right(0.5);   // Turn right at half speed
-    wait (0.5);        // wait half a second
-
-    m3pi.stop();       
-}
\ No newline at end of file
+    #include "mbed.h"
+    #include "m3pi.h"
+    
+    m3pi m3pi;
+    
+    Timer stopwatch;
+    DigitalOut myled(LED1);
+    
+    int main(){
+        
+        int oldtime=0;
+    
+        m3pi.stop();
+    
+        m3pi.locate(0,1);
+        m3pi.printf("butts");
+    
+        stopwatch.reset();
+        stopwatch.start();
+    
+        while (1) {
+         m3pi.locate(0,0);
+         m3pi.printf("%i",stopwatch.read_ms());
+         if (stopwatch,read_ms()-oldtime>1000) {
+             myled=!myled;
+             oldtime=stopwatch.read_ms();
+             
+             }
+        }
+    }
\ No newline at end of file