WPILibC++  2018.4.1-20180819203220-1159-g83cfb8b
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Button.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "frc/buttons/Trigger.h"
11 #include "frc/commands/Command.h"
12 
13 namespace frc {
14 
26 class Button : public Trigger {
27  public:
33  virtual void WhenPressed(Command* command);
34 
43  virtual void WhileHeld(Command* command);
44 
52  virtual void WhenReleased(Command* command);
53 
59  virtual void CancelWhenPressed(Command* command);
60 
66  virtual void ToggleWhenPressed(Command* command);
67 };
68 
69 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
virtual void WhenPressed(Command *command)
Specifies the command to run when a button is first pressed.
virtual void WhileHeld(Command *command)
Specifies the command to be scheduled while the button is pressed.
virtual void CancelWhenPressed(Command *command)
Cancels the specificed command when the button is pressed.
This class provides an easy way to link commands to OI inputs.
Definition: Button.h:26
virtual void ToggleWhenPressed(Command *command)
Toggle the specified command when the button is pressed.
virtual void WhenReleased(Command *command)
Specifies the command to run when the button is released.
The Command class is at the very core of the entire command framework.
Definition: Command.h:48
This class provides an easy way to link commands to inputs.
Definition: Trigger.h:31