Thread: fidget?
View Single Post
  #3   Spotlight this post!  
Unread 27-03-2008, 22:59
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,659
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: fidget?

to clarify that last post, you want to slowly change the command you're sending to the motors. So you take advantage of the fact that pwm values can stay the same from one cycle to the next and say something like:

if (pwm01 < pwm01_cmd)
{
pwm01 += ACCEL;
}

The point being you add a little more to the pwm command every time through the loop till it's where you want it. Now, you still have to set up the decresing side, and you need to check for special cases like if your ACCEL value is 5, pwm01= 202 and pwm01_cmd = 205. Then you'd wobble back and forth from 202 to 207 to 202 to....
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter