View Single Post
  #6   Spotlight this post!  
Unread 20-01-2008, 17:16
Mr. Freeman Mr. Freeman is offline
Put better title here.
AKA: Kellan
no team (CSM Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Colorado
Posts: 198
Mr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to beholdMr. Freeman is a splendid one to behold
Re: Robot Drive for 10 seconds

Quote:
Originally Posted by Mark McLeod View Post
I'd suggest stopping the motors after the 10 seconds are up.
I'd also suggest slowing the motors down before you stop them, also speeding them up instead of just going from 127 to 255. If you don't do this and your robot is top heavy then you run the risk of tipping over. You can do this by modifying your counter slightly.

Sudocode:
pwm_2 = pwm_1;
static int counter = 0;

counter++;
if (counter <= 10)
{
pwm_1 = 137;
}
else if (counter > 10 && counter <= 20)
{
pwm_1 = 157;
}

etc...

We did this one year and it seemed to work pretty well. There might be a better way to do it, but this was simple and we wrote it in about 10 minutes.
__________________
"Time is an illusion, lunchtime doubly so."
-Douglas Adams
“Why is it that I can walk into Wal-Mart and buy boxes of bullets and black powder, but I can’t buy potassium perchlorate to do science because it can also be used to make explosives?”
-Theodore Gray