public class GpioRelayComponent extends RelayBase
DEFAULT_PULSE_MILLISECONDS
listeners
Constructor and Description |
---|
GpioRelayComponent(GpioPinDigitalOutput pin)
default constructor; using this constructor assumes that:
(1) a pin state of HIGH is RELAY CLOSED
(2) a pin state of LOW is RELAY OPEN
|
GpioRelayComponent(GpioPinDigitalOutput pin,
PinState openState,
PinState closedState)
using this constructor requires that the consumer
define the RELAY OPEN and RELAY closed pin states
|
Modifier and Type | Method and Description |
---|---|
RelayState |
getState()
Return the current relay state based on the
GPIO digital output pin state.
|
void |
pulse(int milliseconds) |
void |
setState(RelayState state)
Set the current GPIO digital output pin state
based on the supplied power state
|
addListener, close, isClosed, isOpen, isState, notifyListeners, open, pulse, removeListener, toggle
addListener, removeAllListeners, removeListener
clearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
removeAllListeners
clearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setProperty, setTag
public GpioRelayComponent(GpioPinDigitalOutput pin, PinState openState, PinState closedState)
pin
- GPIO digital output pinopenState
- pin state to set when relay is OPENclosedState
- pin state to set when relay is CLOSEDpublic GpioRelayComponent(GpioPinDigitalOutput pin)
pin
- GPIO digital output pinpublic RelayState getState()
public void setState(RelayState state)
Copyright © 2012–2014 Pi4J. All rights reserved.