Robot code for searching an object and charging at it.
Dependencies: HCSR04 Motor mbed
Diff: main.cpp
- Revision:
- 32:775eec44ba4f
- Parent:
- 30:8a5570b2de68
- Parent:
- 31:70753d91565c
- Child:
- 35:89e13f72cd84
--- a/main.cpp Sun Jun 07 18:35:04 2015 +0000 +++ b/main.cpp Sun Jun 07 18:44:26 2015 +0000 @@ -8,40 +8,38 @@ // Yucando Navarrete // Vivekanand Gupta -// The following code will control a robotic car -// by detetecting an object and charging towards it -// it uses basic functions as: +// The following code controls a robotic car +// by detetecting an object and charging towards it. +// It uses the following basic functions: // // move_forward(speed) -// - used to move_forward on an object detected -// the robot will move in a straight line +// - Used to move the robot toward a detected object. +// The robot will move forwards in a straight line // until it detects the arena line where // it will use reverse() to move back // // detect_object(range, speed) -// - used to detect an object, the robot will -// move in a circle to find an object and -// return 1 if it finds something and return -// 0 if it does not find anything - the search -// will be carried out for 15 seconds. +// - Used to detect an object, the robot will +// move in a circle to find an object. This function +// returns 1 if an object is detected, otherwise it will +// return 0. The search will be carried out for 15 seconds. // // detect_line () -// - used to detect a line, it returns the following -// an int value as follows: -// 0 - if no line is detected -// 1 - if line detected from the front -// -1 - if line detected from the back +// - Used to detect a line, it returns the following values: +// 0 - if no line is detected +// 1 - if line detected from the front +// -1 - if line detected from the back // // reverse(speed) -// - reverses the robot with forwardspeed in same position +// - Reverses the robot in a straight line at given speed. // // stop() -// - stops the robot +// - Stops the robot. // // move_random(speed) -// - used to move the robot randomly, the robot will either +// - Used to move the robot randomly: the robot will either // move forward, move backward, or turn around. The movement -// will be carried out for a random time +// will be carried out for a random time. // // Libraries for using the above functions and more ...