Robot code for searching an object and charging at it.
Dependencies: HCSR04 Motor mbed
Diff: main.cpp
- Revision:
- 28:71781431b010
- Parent:
- 26:5ee2a32949e6
- Child:
- 29:977f47331d85
--- a/main.cpp Sun Jun 07 16:36:03 2015 +0000 +++ b/main.cpp Sun Jun 07 17:33:40 2015 +0000 @@ -103,14 +103,13 @@ detect_l = detect_line(); // If line is detected from front then reverse - if(detect_l == 1) { + if(detect_l == 1 || detect_l == -1) { stop(); turn_led_right(); reverse(searchspeed); wait(1.5); detect_l = 0; break; - // If line is detected from back just keep on moving forward } }