本文整理汇总了Java中com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent.getPin方法的典型用法代码示例。如果您正苦于以下问题:Java GpioPinDigitalStateChangeEvent.getPin方法的具体用法?Java GpioPinDigitalStateChangeEvent.getPin怎么用?Java GpioPinDigitalStateChangeEvent.getPin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent
的用法示例。
在下文中一共展示了GpioPinDigitalStateChangeEvent.getPin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleGpioPinDigitalStateChangeEvent
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; //导入方法依赖的package包/类
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " [" + event.getPin().getName() + "]" + " = " + event.getState());
GpioPin pin = event.getPin();
/*
* if (pin.getName().equals("GPIO 0")) {
* modules.get("01").blinkOff("ok"); } else if
* (pin.getName().equals("GPIO 1")) { modules.get("02").blinkOff("ok");
* } else if (pin.getName().equals("GPIO 2")) {
* modules.get("03").blinkOff("ok"); } else if
* (pin.getName().equals("GPIO 3")) { modules.get("04").blinkOff("ok");
* }
*/
// if (pin.getName().equals(anObject))
}
示例2: handleGpioPinDigitalStateChangeEvent
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; //导入方法依赖的package包/类
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " [" + event.getPin().getName() + "]" + " = " + event.getState());
GpioPin pin = event.getPin();
log.info("GPIOPin: {}", pin);
/*
* if (pin.getName().equals("GPIO 0")) { modules.get("01").blinkOff("ok"); }
* else if (pin.getName().equals("GPIO 1")) {
* modules.get("02").blinkOff("ok"); } else if (pin.getName().equals(
* "GPIO 2")) { modules.get("03").blinkOff("ok"); } else if
* (pin.getName().equals("GPIO 3")) { modules.get("04").blinkOff("ok"); }
*/
// if (pin.getName().equals(anObject))
}
示例3: handleGpioPinDigitalStateChangeEvent
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; //导入方法依赖的package包/类
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
GpioPin pin = event.getPin();
OpenClosedType state = OpenClosedType.CLOSED;
if (event.getState() == PinState.LOW) {
state = OpenClosedType.OPEN;
}
ChannelUID channelForPin = pinStateHolder.getChannelForInputPin((GpioPinDigitalInput) pin);
logger.debug("updating channel {} with state {}", channelForPin, state);
updateState(channelForPin, state);
}
示例4: handleGpioPinDigitalStateChangeEvent
import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent; //导入方法依赖的package包/类
/**
* @{inheritDoc}
*/
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
GpioPin pin = event.getPin();
OpenClosedType state = OpenClosedType.CLOSED; // Assume we are high...
if (event.getState() == PinState.LOW) { // To err is human...
state = OpenClosedType.OPEN;
}
this.eventPublisher.postUpdate(pin.getName(), state);
logger.debug("GPIO pin state change: {} = {}", pin, state);
}