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



Hit Counter

 

<<

functions\deposit.c


Click to enlarge

void deposit (float side)
{
int ambitious=0, full_speed=50, x, so_tired, side_align, check=1, distance;

turn(-95.*side,50);

/* double checks straight function because it sucks here */
while (check==1)
{
distance=straight(full_speed,full_speed,100.,1);
if (distance>35)
{
if(sensor_check()==1)
{
straight(-full_speed,-full_speed,3.,0);
turn(45.,50);
}
if(sensor_check()==3)
{
straight(-full_speed,-full_speed,2.,0);
turn(-45.,50);
}
check=0;
}
}

straight(full_speed,full_speed,100.,1);
side_align=2;
wall_align(sensor_check(),full_speed,side_align);
arm_servo(64.);
straight(-full_speed,-full_speed,1.5,0);
turn(120.*side,50);
straight(full_speed,full_speed,100.,1);
wall_align(sensor_check(),full_speed,side_align);
straight(-full_speed,-full_speed,1.,0);
turn(-115.*side,50);
if (side>0.)

right_motor(-35);
left_motor(-60);
}

if (side<0.)
{
right_motor(-60);
left_motor(-35);
}
while(mercury()==0);
sleep(1.5);
while(mercury()==1);

motors_off();
straight(-full_speed,-full_speed,2.15,0);
sleep(2.);
/* depositing */
beep();
/*
if (side>0.)

right_motor(50);
left_motor(40);
}

if (side<0.)
{
right_motor(40);
left_motor(50);
}*/
/* sorting sequence */
while(ambitious!=2)
{
ambitious++;
for(x=62;x<=96;x+=2)
{
arm_servo((float)x);
sleep(.02);
}
for(so_tired=1;so_tired<=20;so_tired++)
{
for(x=80;x<=96;x+=2)
{
arm_servo((float)x);
sleep(.01);
}
for(x=96;x>=80;x-=2)
{
arm_servo((float)x);
sleep(.01);
}
}
arm_servo(40.);
sleep(1.);
}
arm_servo(62.);
turn(-10.*side,50);
beep();
}

© '02 James Beams

http://beams.oxonet.com