com.google.android.things.pio.Gpio.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中com.google.android.things.pio.Gpio.getValue()方法的一些代码示例,展示了Gpio.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gpio.getValue()方法的具体详情如下:
包路径:com.google.android.things.pio.Gpio
类名称:Gpio
方法名:getValue

Gpio.getValue介绍

暂无

代码示例

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
public boolean onGpioEdge(final Gpio gpio) {
  if (DEBUG) {
    try {
      Log.e(TAG, "GPIO: " + gpio.getValue());
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  notifyDigital();
  return true;
}
@Override

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
  public boolean onGpioEdge(Gpio gpio) {
    try {
      // 顯示GPIO狀態
      Log.i(TAG, "Mini Reed: " + gpio.getValue());
    }
    catch (IOException e) {
      Log.e(TAG, e.toString());
    }
    return true;
  }
});

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
public FaBoShield.Level getDigital(final FaBoShield.Pin pin) {
  try {
    Gpio gpio = mGpioMap.get(pin.getPinNumber());
    if (gpio != null) {
      return gpio.getValue() ? FaBoShield.Level.HIGH : FaBoShield.Level.LOW;
    }
    return null;
  } catch (Exception e) {
    return null;
  }
}

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
  public void run() {
    if (ledGpio == null) {
      return;
    }
    try {
      // 設定GPIO狀態
      ledGpio.setValue(!ledGpio.getValue());
      Log.i(TAG, "LED: " + (ledGpio.getValue() ? "ON" : "OFF"));
      // 1秒以後重複執行
      ledHandler.postDelayed(ledRunnable, 1000);
    }
    catch (IOException e) {
      Log.e(TAG, e.toString());
    }
  }
};

代码示例来源:origin: macdidi5/Android-Things-Tutorial

@Override
  public boolean onGpioEdge(Gpio gpio) {
    try {
      boolean uploadPicture =
          (isHigh.equals("true") && gpio.getValue()) ||
          (isLow.equals("true") && (!gpio.getValue()));
      if (uploadPicture) {
        screen.showAction(addPhoto);
        camera.setPinName(pin.name());
        camera.setStatus(gpio.getValue());
        camera.takePicture();
      }
      else {
        childControl.child(pin.name()).setValue(gpio.getValue());
      }
      Log.d(TAG, "Listener: " + pin.name() + "/" + gpio.getValue());
    }
    catch (IOException e) {
      Log.e(TAG, e.toString());
    }
    return true;
  }
});

代码示例来源:origin: macdidi5/Android-Things-Tutorial

adcOut <<= 1;
if (serialDataOutput.getValue()) {
  adcOut |= 0x1;

相关文章