Robot code for searching an object and charging at it.

Dependencies:   HCSR04 Motor mbed

Files at this revision

API Documentation at this revision

Comitter:
alex0612
Date:
Sat May 30 16:14:43 2015 +0000
Parent:
16:02e533e3a91c
Child:
18:7bd638e3926d
Commit message:
Fixed move_detect

Changed in this revision

functions.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;
         }