Home
Projects
Blog
My Resume
Project193
BRB or BBL
Robot
Guestbook
Old Stuff
Email



Hit Counter

 

<<

functions\wall_align.c  


Click to enlarge

/* aligns robot straight with wall */

void wall_align (int side_hit, int motor_speed, int align_side)
{
if(align_side==2)
{
motors_off();
if (side_hit==1)
{
right_motor(motor_speed);
while(right_front()==0);
right_motor(0);
}

if (side_hit==3)
{
left_motor(motor_speed);
while(left_front()==0);
left_motor(0);
}
}

if(align_side==8)
{
motors_off();
right_motor(-motor_speed);
while(left_back()==0);
right_motor(0);
}

if(align_side==4)
{
motors_off();
left_motor(-motor_speed);
while(right_back()==0);
left_motor(0);
}

if(align_side==6)
{
motors_off();
if (side_hit==7)
{
right_motor(-motor_speed);
left_motor(-motor_speed/2);
while(right_back()==0);
right_motor(0);
left_motor(0);
}

if (side_hit==5)
{
left_motor(-motor_speed);
right_motor(-motor_speed/2);
while(left_back()==0);
left_motor(0);
right_motor(0); 
}
}
}

© '02 James Beams

http://beams.oxonet.com