WPILibC++  2019.1.1-beta-4-1-g6e8f8be
 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:
28  Button() = default;
29  Button(Button&&) = default;
30  Button& operator=(Button&&) = default;
31 
37  virtual void WhenPressed(Command* command);
38 
47  virtual void WhileHeld(Command* command);
48 
56  virtual void WhenReleased(Command* command);
57 
63  virtual void CancelWhenPressed(Command* command);
64 
70  virtual void ToggleWhenPressed(Command* command);
71 };
72 
73 } // 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