View Single Post
  #2   Spotlight this post!  
Unread 16-02-2004, 21:33
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: inputting data for autonomous mode

take the code from inside the Default_Routine() function, and put it in the User_Autonomous_Code() function (in user_routines_fast.c) instead. it should look like this:

Code:
/* in user_routines_fast.c */
 
void User_Autonomous_Code(void)
{
  while (autonomous_mode)   /* DO NOT CHANGE! */
  {
    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {
        Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */

        if(rc_dig_in06 == 0)  /* if dark is seen */
                {
                pwm01=pwm03=127; /* turn left motors off */
                pwm02=pwm04=96; /* turn right motors forward slowly */
                }
        else 
                {
                pwm01=pwm03=159; /* turn left motors forward slowly */
                pwm02=pwm04=127; /* turn right motors off */
                }

printf("%d\n", rc_dig_in06); /* print light sensor readings */
        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
}
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)