View Single Post
  #2   Spotlight this post!  
Unread 21-01-2013, 19:34
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: Command-based while button presed

Quote:
Originally Posted by Arhowk View Post
I want to run a specific command but i only want to run it when the button is pressed but i cant find the specific function for that

Code:
            OI.controlDriver.buttonA.whenPressed(RobotMap.intakeIn);
            OI.controlDriver.buttonA.whenReleased(RobotMap.intakeIn);
            OI.controlDriver.buttonB.whileHeld(RobotMap.intakeOut);
they just continually run the command
The problem isn't in the button call itself. You need to set the isFinished() method in your command to something other than "false," otherwise it will never complete.

Psuedocode:

Code:
isFinished() {
      when (frisbeeIsLoaded)
              return true;
}
or

Code:
isFinished() {
       return isTimedOut();
}
When isFinished() returns true, it calls end() and stops the command. If it never returns true, end() is never called.
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional

Last edited by F22Rapture : 21-01-2013 at 19:42.
Reply With Quote