Insert this into Randi's program!

Dependencies:   m3pi_ng mbed

Files at this revision

API Documentation at this revision

Comitter:
satyson
Date:
Wed May 21 12:26:34 2014 +0000
Commit message:
This is for turning around

Changed in this revision

m3pi_ng.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 5318196e952d m3pi_ng.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m3pi_ng.lib	Wed May 21 12:26:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ngoldin/code/m3pi_ng/#da9ef3d5c3fe
diff -r 000000000000 -r 5318196e952d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 21 12:26:34 2014 +0000
@@ -0,0 +1,46 @@
+    #include "mbed.h"
+    #include "m3pi_ng.h"
+    
+    DigitalOut myled(LED1);
+    void turn_around (int array[5]);
+    m3pi George;
+    
+    int main() 
+    {
+ 
+    }
+    
+    void turn_around (int array[5])
+    {
+        // Declaring Variables
+        int threshold = 200;
+        int speed = 0.3;
+        
+        bool turn  = true;
+        //NOT NEEDED : int amt    = 0;
+        // Check to see if all sensors are lower than threshold 
+        
+        for(int i = 0; i < 5; i++)
+        {
+            if(array[i] > threshold)
+            {
+                turn = false;  
+            }
+                
+         }
+           
+        while (turn)
+        {
+            George.left_motor(speed);
+            George.right_motor(-speed);
+            
+            for(int i = 0; i < 5; i++)
+            {
+                if(array[i] > threshold)
+                {
+                    turn = true;  
+                } 
+            }
+                    
+        }
+    }
\ No newline at end of file
diff -r 000000000000 -r 5318196e952d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 21 12:26:34 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file