satoshi yuki / Mbed 2 deprecated mbed_paparazzibot_4180Final

Dependencies:   Motor mbed

Revision:
2:9a3221b22855
Parent:
1:5265e3a6f3d7
Child:
3:c9e09e968552
diff -r 5265e3a6f3d7 -r 9a3221b22855 main.cpp
--- a/main.cpp	Wed Dec 07 20:36:22 2016 +0000
+++ b/main.cpp	Wed Dec 07 20:46:37 2016 +0000
@@ -21,11 +21,11 @@
 int Rtot=0;
 int Ltot=0;
 char c;
-int pics = 0;
+int targets = 0;
 int TError = 0;
 char V;
 char M;
-
+int current = 1;
 
 Ticker Sampler;
 
@@ -121,6 +121,7 @@
         }
         else if (Instr == 5) {
         
+        for (current < targets+1){
         LMotor.speed(0);
         RMotor.speed(0);
         wait(.2);
@@ -146,8 +147,12 @@
             wait(1);//snap tons of photos
             LMotor.speed(-Lspeed);
             RMotor.speed(-Rspeed);
+            wait(1);
+            current = targets+1; //if a match is found, stops the search
             }
+            else current++;
         }
+        Instr = 0; //turns status to stop after search
         /*
     switch (Instr){