Class TouchSwitchHelper
java.lang.Object
com.opensourcewithslu.inputdevices.TouchSwitchHelper
The TouchSwitchHelper class is used to initialize a touch switch.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTouchSwitchHelper
(com.pi4j.io.gpio.digital.DigitalInput touchSwitchInput) TouchSwitchHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an event listener to the touch switch.void
Removes the event listener from the touch switch.
-
Field Details
-
isTouched
public boolean isTouchedShows if the touch switch has been touched.
-
-
Constructor Details
-
TouchSwitchHelper
public TouchSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput touchSwitchInput) TouchSwitchHelper constructor.- Parameters:
touchSwitchInput
- A Pi4J DigitalInput object.
-
-
Method Details
-
addEventListener
public void addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an event listener to the touch switch.- Parameters:
function
- A Pi4J DigitalStateChangeListener object.
-
removeEventListener
public void removeEventListener()Removes the event listener from the touch switch.
-