View Single Post
  #2   Spotlight this post!  
Unread 17-02-2010, 21:11
miniman's Avatar
miniman miniman is offline
Registered User
FRC #0701
 
Join Date: Sep 2007
Rookie Year: 2007
Location: fairfield
Posts: 10
miniman is an unknown quantity at this point
Re: Programming Pots

be careful with your comparison of kickerValue to HIGH_POT. because the programs happens in loops, kickerValue is a snapshot of it's current position, a frame if you will. The moment that kickerValue is equal to High_POT may occur between frames. Use a >= or <=, to check if kickerValue is at or past the HIGH_POT value.

The idea is that with a single button press, the kicker will move to a position determined by a pot right?

Code:
if (button pressed)
    //set a bool to true to indicate that the kicker is in forward "mode"
if (in forward mode)
{
     if(kickerValue < HIGH_POT)
         //move kicker forward
     else
     {
          //stop kicker
          //set bool to false to indicate the kicker is done
     }
}
good idea to use a variable stopping point for the kicker.
__________________
--The most exciting phrase to hear in science, the one that heralds new discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...' -Issac Asimov

Last edited by miniman : 17-02-2010 at 21:20.