View Single Post
  #4   Spotlight this post!  
Unread 25-03-2004, 14:44
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: More automonous help:ending stuff

In your User_Initialization create a variable called count (you can create it anywhere but that's probably the best spot for now), with this syntax:

int count = 0;

Then at the bottom of the while(autonomous_mode) loop in your code, right above Putdata(&txdata), put in

count++;

++ in C means the same thing as "count = count + 1;", so you are incrementing it by one every time you pass through that loop. Multiply count by 40 and you have *approximately* the amount of time autonomous has been running. You'll have to time it and do the math yourself, but when you want it to break off, say something like (below your line following code):

if(count > 200){
pwm01 = 254;
pwm02 = 254;
}
else if(count > 300){
pwm01 = 0;
pwm02 = 0;
}
else if (count > 320){
pwm01 = 127;
pwm02 = 127;
}

That won't do much, just go forward and stop after a little over 2 seconds, but hopefully you get the picture on what you can do. Adjust values to your desire, and good luck.
__________________
~Alex Baxter
Programming, Arms operation, Team 254