View Single Post
  #2   Spotlight this post!  
Unread 20-02-2005, 18:14
jimfortytwo jimfortytwo is offline
Registered User
AKA: Jim Paulos
#0418 (Purple Haze)
Team Role: Student
 
Join Date: Feb 2003
Rookie Year: 2002
Location: austin
Posts: 65
jimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nicejimfortytwo is just really nice
Send a message via ICQ to jimfortytwo Send a message via AIM to jimfortytwo Send a message via Yahoo to jimfortytwo
Re: Any Examples Of Ready To Go Autonymous Code Out There ?

How simple is simple?
How about driving forwards for about 5 seconds, and then stopping?
There are good threads on using arrays to do multiple-step routines, using a "timer" like this. Consider this a specific answer to a vague question.

//add this to the top of the user_routines_fast.c file
int timer =0;


/*this is the section of User_Autonomous_Code() in user_routines_fast.c
that you want to edit*/
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! */

/*****************/ //here is the change
if(timer < 190)
pwm01 = pwm02 = pwm03 = pwm04 = 255;
else
pwm01 = pwm02 = pwm03 = pwm04 = 127;
timer++;
/******************/


Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}