View Single Post
  #18   Spotlight this post!  
Unread 21-01-2007, 02:41
NextPerception NextPerception is offline
Sleep-Deprived
AKA: Matt
FRC #0437 (Richardson Robotics)
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2005
Location: Richardson, TX
Posts: 69
NextPerception has a spectacular aura aboutNextPerception has a spectacular aura aboutNextPerception has a spectacular aura about
Send a message via AIM to NextPerception
Re: Potentiometer PID

instead of

Code:
      if ( Button1 == 1 )
      {
            Target = 200 ;
      }
      else if ( Button2 == 1 )
      {
            Target = 400 ;
      }
      else if ( Button3 == 1 )
      {
            Target = 600 ;
      }
i would do this

Code:
      if ( (Button1 * Button2) + (Button2 * Button3) + (Button3 * Button1) + ( Button1 + Button2 + Button3 ) == 1 )   //prevents crazy values if more than one button is pressed and keeps the same value if no button is pressed
      {
            Target = (Button1 * 200) + (Button2 * 400) + (Button3 * 600)
      }
this just makes more sense to me and I just post it here for any like minded people out there. I think it takes a little less cpu time too.
__________________
What is this S - L - E - E - P you speak of?
Battlebots - My Robotics Website


Last edited by NextPerception : 21-01-2007 at 02:55.