View Single Post
  #2   Spotlight this post!  
Unread 11-11-2009, 18:46
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: [FTC]: Spin Motor Wind Down: Programming

I would use this

if(joystick.joy1_y1 == 0 && motorspeed > 0)
{
motorspeed = motorspeed - (desired decrement)

}

it's simple and simplicity is the key. So what is basically happening in this code is that if you've let go of the left joystick and the motor hasn't stopped then it will decrease the speed then the rest of the code will execute then the process will repeat. The only tricky thing about this is the decrement will have to be small because the code will repeat almost immediately.
Reply With Quote