Class SlideSwitchHelper
java.lang.Object
com.opensourcewithslu.inputdevices.SlideSwitchHelper
The SlideSwitchHelper class is used to initialize a slide switch.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSlideSwitchHelper
(com.pi4j.io.gpio.digital.DigitalInput slideSwitchInput) SlideSwitchHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an EvenListener to the slide switch.void
Initializes the listener that keeps track of whether the slide switch is high/low.void
removeEventListener
(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Removes the EventListener from the slide switch.
-
Field Details
-
isOn
public boolean isOnShows if the slide switch is on.
-
-
Constructor Details
-
SlideSwitchHelper
public SlideSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput slideSwitchInput) SlideSwitchHelper constructor.- Parameters:
slideSwitchInput
- A Pi4J DigitalInput Object.
-
-
Method Details
-
initialize
public void initialize()Initializes the listener that keeps track of whether the slide switch is high/low. Automatically called when the SlideSwitchHelper is instantiated. -
addEventListener
public void addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an EvenListener to the slide switch.- Parameters:
function
- A Pi4J DigitalStateChangeListener object.
-
removeEventListener
public void removeEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Removes the EventListener from the slide switch.- Parameters:
function
- A Pi4J DigitalStateChangeListener object.
-