当前位置: 首页>>代码示例>>Java>>正文


Java GpioPinDigitalStateChangeEvent.getPin方法代码示例

本文整理汇总了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))
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:20,代码来源:PickToLight.java

示例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))
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:18,代码来源:PickToLight.java

示例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);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:12,代码来源:Mcp23017Handler.java

示例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);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:14,代码来源:MCP23017Binding.java


注:本文中的com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent.getPin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。