|
Re: Robot Drive for 10 seconds
Quote:
Originally Posted by Mark McLeod
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
|