本文整理汇总了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);
}
示例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: 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!");
}
示例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;
}
}
示例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();
}
示例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);
}
示例7: isOn
@Override
public boolean isOn() {
if(outputPin != null) {
return adjustState(outputPin.getState()) == PinState.HIGH;
}
logGpioAccessDisabled();
return false;
}
示例8: adjustState
private PinState adjustState(PinState pinState) {
if(reverseStates) {
if(pinState == PinState.HIGH) {
return PinState.LOW;
}
return PinState.HIGH;
}
return pinState;
}
示例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;
}
}
}
}
示例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;
}