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


Java PinState.HIGH属性代码示例

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


在下文中一共展示了PinState.HIGH属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setup

@Override
protected void setup(String[] args) {
    super.setup(args);
    if(args.length == 1){
        device_fileName = args[0];         
    }else{
        throw new RuntimeException(
                "Please provide a device file name from "
                        +Ex16_Ds18b20.W1_DEVICES_PATH);
    }
    ledRed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03);
    ledGreen = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04);
    ledBlue = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05);
    beep = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_08);
    joyStick_Z = gpio.provisionDigitalInputPin(RaspiPin.GPIO_06, PinPullResistance.PULL_UP);
    joyStick_Z.addListener(new GpioPinListenerDigital() {
        @Override
        public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent gpdsce) {
            sys_state = PinState.LOW;
            logger.debug("interrupt occur !");
        }
    });
    sys_state = PinState.HIGH;
    logger.debug("Temperature monitor ready!");                
}
 
开发者ID:marcandreuf,项目名称:sunfounder-sensors-raspi-4j,代码行数:25,代码来源:Ex30_TempMonitor.java

示例4: getValue

@Override
public synchronized boolean getValue(GpioPin pin) {
	//Check if this pin is assigned as an out pin
	if (isOutPin(pin)) {
		setAsInput(pin);
	}
	if (!isInPin(pin)) {
		setAsInput(pin);
	}
	try {
		PinState state = inpins.get(pin).getState();
		if (state == PinState.HIGH) {
			return true;
		} else {
			return false;
		}
	}
	catch (Exception ex) {
		System.err.println("GpioControlPi4J.java>getValue() Exception: " + ex);
		System.out.println("GpioControlPi4J.java>getValue() Exception: " + ex);
		return false;
	}
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:23,代码来源:GpioControlPi4J.java

示例5: 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

示例6: 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

示例7: isOn

@Override
public boolean isOn() {
    if(outputPin != null) {
        return adjustState(outputPin.getState()) == PinState.HIGH;
    }
    logGpioAccessDisabled();
    return false;
}
 
开发者ID:camueller,项目名称:SmartApplianceEnabler,代码行数:8,代码来源:Switch.java

示例8: 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

示例9: handleGpioPinDigitalStateChangeEvent

@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) 
{
    PinState state = event.getState();
    if(state == PinState.HIGH)
    {
        if(takingSnapshot)
        {
            String message = "The foot pedal was pressed, while already taking a photo.";
            System.out.println(message);
        }
        else
        {
            ServletContext servletContext = getServletContext();
            Camera camera = (Camera) servletContext.getAttribute(CAMERA_KEY);
            if(camera == null)
            {
                System.err.println("The foot pedal servlet did not find the camera.");
            }
            else
            {
                takingSnapshot = true;
                camera.takeSnapshot();
                takingSnapshot = false;                    
            }
        }
    }
}
 
开发者ID:onebeartoe,项目名称:photorama,代码行数:28,代码来源:FootPedalServlet.java

示例10: GpioControlPi4J

private GpioControlPi4J() {
	gpio = GpioFactory.getInstance();
	inpins = new HashMap<uk.co.jaynne.gpio.GpioPin, com.pi4j.io.gpio.GpioPin>();
	outpins = new HashMap<uk.co.jaynne.gpio.GpioPin, com.pi4j.io.gpio.GpioPin>();
	outDefaultState = PinState.HIGH;
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:6,代码来源:GpioControlPi4J.java


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