Society of Robots - Robot Forum
Software => Software => Topic started by: jabird60 on April 20, 2011, 10:50:58 AM
-
I have to source code to the IR Range finder and i just need to kno what to change to make it move away from things instead of hauling butt to them.. I have the
//object on left
if(scan_angle > 57)
robot_turn_right();
//object on right
else if(scan_angle < 41)
robot_turn_left();
fixed because you just swap them but im not sure how to make it go backwards and how to change it to if it doesnt see anything go straight and not keep looking for something.
-
What kind of microcontroller are you using? How are you controlling the motors? Since you can make the robot turn left and right, you appear to already have the ability to move the motors backwards and forwards, so why not just do:
//keep moving until see the obstacle
robot_move_forwards();
//object on left -- turn right and move backwards
if(scan_angle > 57)
robot_turn_right();
robot_move_backwards();
Then after a while (a second or something), start moving forward again.
I'm not 100% sure I understand what you're asking, but if you can go straight, you can go backwards.
MIKE
-
I am useing the ATMEGA8.. And i just need to kno what to put in my sohc.h file to make it go backwards.. There is a left,right,straight but no back.. i just need to kno what number to put that makes the servo turn backwards