Command-based while button presed

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


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.


isFinished() {
      when (frisbeeIsLoaded)
              return true;


isFinished() {
       return isTimedOut();

When isFinished() returns true, it calls end() and stops the command. If it never returns true, end() is never called.

We found somewhere in the documentation where u need to put it in the interrupted function and it worked for us.

Yeah… was about to say that putting the cancel functions in interrupted and not end worked.

On a slightly related topic, can I wipe the commands currently linked to a button?

i can do


but can i do


so that it no longer runs the commands issued by .whilePressed()