Class ReedSwitchHelper
java.lang.Object
com.opensourcewithslu.inputdevices.ReedSwitchHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanShows if the reed switch has detected magnetic field. -
Constructor Summary
ConstructorsConstructorDescriptionReedSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput reedSwitchDigitalInput) ReedSwitchHelper constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an event listener to the Reed switch.voidRemoves the event listener from the Reed switch.
-
Field Details
-
isDetected
public boolean isDetectedShows if the reed switch has detected magnetic field.
-
-
Constructor Details
-
ReedSwitchHelper
public ReedSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput reedSwitchDigitalInput) ReedSwitchHelper constructor.- Parameters:
reedSwitchDigitalInput- A Pi4J DigitalInput object.
-
-
Method Details
-
addEventListener
public void addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function) Adds an event listener to the Reed switch.- Parameters:
function- A Pi4J DigitalStateChangeListener object.
-
removeEventListener
public void removeEventListener()Removes the event listener from the Reed switch.
-