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


Java PinState.LOW属性代码示例

本文整理汇总了Java中com.pi4j.io.gpio.PinState.LOW属性的典型用法代码示例。如果您正苦于以下问题:Java PinState.LOW属性的具体用法?Java PinState.LOW怎么用?Java PinState.LOW使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.pi4j.io.gpio.PinState的用法示例。


在下文中一共展示了PinState.LOW属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RGBLed

public RGBLed(DiodeType type,Pin red,Pin green,Pin blue) {
	this.type = type;
	this.pinR = red;
	this.pinG = green;
	this.pinB = blue;
	this.color = LedColor.OFF;
	gpio = GpioFactory.getInstance();
	int defaultValue = (DiodeType.ANODE_COMMON.equals(type)) ? 1 : 0;
	PinState defaultState = (DiodeType.ANODE_COMMON.equals(type)) ? PinState.HIGH : PinState.LOW;
	outRed = gpio.provisionSoftPwmOutputPin(pinR, "Red", defaultValue);
	outRed.setShutdownOptions(true, defaultState, PinPullResistance.OFF);
	outGreen = gpio.provisionSoftPwmOutputPin(pinG, "Green", defaultValue);
	outGreen.setShutdownOptions(true, defaultState, PinPullResistance.OFF);
	outBlue = gpio.provisionSoftPwmOutputPin(pinB, "Blue", defaultValue);
	outBlue.setShutdownOptions(true, defaultState, PinPullResistance.OFF);
}
 
开发者ID:gustavohbf,项目名称:robotoy,代码行数:16,代码来源:RGBLed.java

示例2: rotaryDeal

private void rotaryDeal() {
   lastRoBStatus = roBPin.getState();
        
    while(roAPin.isLow()){
        currentRoBStatus = roBPin.getState();
        flag=true;
    }
        
    if(flag){
        flag = false;
        if(lastRoBStatus==PinState.LOW && currentRoBStatus==PinState.HIGH){
            globalCounter ++;
        }
        if(lastRoBStatus==PinState.HIGH && currentRoBStatus==PinState.LOW){
            globalCounter --;
        }
    }
}
 
开发者ID:marcandreuf,项目名称:sunfounder-sensors-raspi-4j,代码行数:18,代码来源:Ex17_RotaryEncoder.java

示例3: handleGpioPinDigitalStateChangeEvent

@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) 
{
    String s;
    PinState state = event.getState();
    if(state == PinState.LOW)
    {
        s = "low: ";
    }
    else
    {
        s = "high: ";
    }
       
    System.out.println("*Photo booth button pin state changed to " + s + state + ".");
}
 
开发者ID:onebeartoe,项目名称:photorama,代码行数:16,代码来源:PhotoBoothButtonTester.java

示例4: onSignalClosure

/**
   * Gets called whenever we get a long enough pulse to consider as an being part of the signal itself
   * @param startPulsePosition Index in 'incoming_signal' that we'll consider as being the start of this sequence of pulses
   * @param excludingPulsePosition Index in 'incoming_signal' that we'll consider as being the end (excluding itself) of this sequence of pulses
   */
  private void onSignalClosure(int startPulsePosition, int excludingPulsePosition) {
  	previousSignalPulseCount = pulseCount.longValue();
  	if (pendingSignalSaturated.get()) {
  		// Did not finish processing previous signal, we'll ignore this one
      	currentSignalStart = modulus(excludingPulsePosition,MAX_PULSES);
  		return;
  	}
  	if (startPulsePosition==excludingPulsePosition) {    		
  		// No signal
  		return;
  	}
  	pendingSignalSaturated.set(true);
  	// Copies signal
  	int lastPulsePosition = modulus(excludingPulsePosition-1 , MAX_PULSES);
  	int length;
  	if (lastPulsePosition>=startPulsePosition) {
  		length = lastPulsePosition-startPulsePosition+1;
  		System.arraycopy(incoming_signal, /*srcPos*/startPulsePosition, pending_signal, /*destPos*/0, /*length*/length);
  		pending_signal_size = length;
  	}
  	else if (lastPulsePosition<startPulsePosition) {
  		int part1_length = (MAX_PULSES - startPulsePosition);
  		int part2_length = lastPulsePosition+1;
  		length = part1_length + part2_length;
  		System.arraycopy(incoming_signal, /*srcPos*/startPulsePosition, pending_signal, /*destPos*/0, /*length*/part1_length);
  		System.arraycopy(incoming_signal, /*srcPos*/0, pending_signal, /*destPos*/part1_length, /*length*/part2_length);
  		pending_signal_size = length;
  	}
pending_signal_start_pin_level = ((startPulsePosition%2)==0) ? PinState.HIGH : PinState.LOW;
  	currentSignalStart = modulus(excludingPulsePosition,MAX_PULSES);
 		signalReceived.release();
  }
 
开发者ID:gustavohbf,项目名称:robotoy,代码行数:37,代码来源:IRReceive.java

示例5: LedImpl

public LedImpl(final RobotGPIO pi2goGPIO, final Pin ledPin, boolean onIsHigh) {

        if (onIsHigh){
            this.on = PinState.HIGH;
            this.off = PinState.LOW;
        }else{
            this.on = PinState.LOW;
            this.off = PinState.HIGH;
        }
        
        this.ledPin = ledPin;
        this.led = pi2goGPIO.provisionDigitalOutputPin(ledPin, off);
        this.led.setShutdownOptions(true, off);
    }
 
开发者ID:fustinoni-net,项目名称:PiRobotPlatform,代码行数:14,代码来源:LedImpl.java

示例6: adjustState

private PinState adjustState(PinState pinState) {
    if(reverseStates) {
        if(pinState == PinState.HIGH) {
            return PinState.LOW;
        }
        return PinState.HIGH;
    }
    return pinState;
}
 
开发者ID:camueller,项目名称:SmartApplianceEnabler,代码行数:9,代码来源:Switch.java

示例7: handleGpioPinDigitalStateChangeEvent

@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,代码行数:11,代码来源:Mcp23017Handler.java

示例8: handleGpioPinDigitalStateChangeEvent

/**
 * @{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,代码行数:13,代码来源:MCP23017Binding.java


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