Robot C-program for Group A-3 (temp), E5 Fall 2002

Alan McAvinney

Ryan Kuker

Disha Katharani

Scott Birney

void main(void)
{
    int bump=0, lbump=0, rbump=0, x=5;
    int globalmax, right, left;
    printf("\n i love u ryan");
    sleep(2.0);
    beep();
    printf("\n i love u disha");
    sleep(1.0);
    beep();
    printf("\n i love u scott");
    sleep(2.0);
    beep();
    printf("\n i love u alan");
    sleep(1.0);
    beep();
    printf("\n Place on hottest spot");
    start_press();
    globalmax=analog(5);
    beep();
    printf("\n Place on random spot");
    start_press();
    motor(0,100);
    motor(1,100);
    while((analog(5)+x<globalmax)||(analog(6)+x<globalmax))
      {
        if((analog(5)+x<analog(6))&&!(analog(6)+x<analog(5)))
          {
            motor(0,40);
            motor(1,-40);
        }
        if((analog(6)+x<analog(5))&&!(analog(5)+x<analog(6)))
          {
            motor(1,40);
            motor(0,-40);
        }
        if((analog(6)+x>analog(5))&&(analog(5)+x>analog(6)))
          {
            motor(1,40);
            motor(0,40);
        }
        if (!digital(7))
          {
            printf("\n right bump");
            rbump=rbump+1;
            bump=bump+1;
            motor(0,-100);
            motor(1,100);
            sleep(2.0);
            printf("\n %d right bumps and %d bumps total", rbump, bump);
            motor(0,100);
        }
        if (!digital(8))
          {
            printf("\n left bump");
            lbump=lbump+1;
            bump=bump+1;
            motor(0,100);
            motor(1,-100);
            sleep(2.0);
            printf("\n %d left bumps and %d bumps total", lbump, bump);
            motor(1,100);
        }
        if (stop_button())
          {
            printf ("\n paused");
            start_press();
        }
    }
    beep();
    ao();
    printf("\n Hottest Spot");
}