Class PushButtonHelper
java.lang.Object
com.opensourcewithslu.inputdevices.PushButtonHelper
The PushButtonHelper class is used to create a listener that determines when a 4 pin button is pressed.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPushButtonHelper
(com.pi4j.io.gpio.digital.DigitalInput buttonInput) The PushButtonHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an EventListener to the PushButton.void
Initializes the PushButton.void
removeEventListener
(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Removes an EvenListener from the button.
-
Field Details
-
isPressed
Determines if the button is pressed.
-
-
Constructor Details
-
PushButtonHelper
public PushButtonHelper(com.pi4j.io.gpio.digital.DigitalInput buttonInput) The PushButtonHelper constructor.- Parameters:
buttonInput
- A Pi4J DigitalInput Object.
-
-
Method Details
-
initialize
public void initialize()Initializes the PushButton. Automatically called when the PushButton is created. -
addEventListener
public void addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an EventListener to the PushButton.- Parameters:
function
- A DigitalStateChangeListener Object.
-
removeEventListener
public void removeEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Removes an EvenListener from the button.- Parameters:
function
- The listener to be removed.
-