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



Hit Counter

 

<<

functions\turn.c  


Click to enlarge

void turn(float turn_deg, int motor_speed)
{
int tics=0, L_motor_tics=0, R_motor_tics=0; 

motors_off();
encoder1_counts=0;
encoder3_counts=0;

if (turn_deg>0.)
{
tics=(int)(turn_deg/6.43);
left_motor(motor_speed);
right_motor(-motor_speed);
}

if (turn_deg<0.)
{
tics=(int)(-turn_deg/6.43);
left_motor(-motor_speed);
right_motor(motor_speed);
}
while (L_motor_tics<=tics && R_motor_tics<=tics)
{
printf("L %d R %d T %d\n",L_motor_tics, R_motor_tics, tics);
L_motor_tics=encoder1_counts;
R_motor_tics=encoder3_counts;
}
motors_off();
}

© '02 James Beams

http://beams.oxonet.com