本文整理汇总了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);
}
示例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 --;
}
}
}
示例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 + ".");
}
示例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();
}
示例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);
}
示例6: adjustState
private PinState adjustState(PinState pinState) {
if(reverseStates) {
if(pinState == PinState.HIGH) {
return PinState.LOW;
}
return PinState.HIGH;
}
return pinState;
}
示例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);
}
示例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);
}