Robot code for searching an object and charging at it.

Dependencies:   HCSR04 Motor mbed

Revision:
17:47aa9ef2bec6
Parent:
14:e639a42edf2e
Child:
19:67ea4e8be9e1
--- a/functions.cpp	Sat May 30 16:05:07 2015 +0000
+++ b/functions.cpp	Sat May 30 16:14:43 2015 +0000
@@ -209,13 +209,12 @@
         detect = detect_line();
         // If line is detected from front then reverse
         if(detect == 1) {
-            reverse(speed);
-            wait(2);
+            move_detect(-speed,1,1500);
             stop();
             break;
-            // If line is detected from back just keep on moving forward
+        // If line is detected from back just keep on moving forward
         } else if (detect == -1) {
-            wait(2);
+            move_detect(speed,1,1500);
             stop();
             break;
         }