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


Java DigitalChannel.setMode方法代码示例

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


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

示例1: digital

import com.qualcomm.robotcore.hardware.DigitalChannel; //导入方法依赖的package包/类
/**
 * wrap a DigitalChannel in a DigitalSensor
 *
 * @param digitalChannel the input to wrap
 * @return the created DigitalSensor
 */
public static DigitalSensor digital(final DigitalChannel digitalChannel) {
    digitalChannel.setMode(DigitalChannelController.Mode.INPUT);

    return new DigitalSensor() {
        @Override
        public Boolean getValue() {
            return digitalChannel.getState();
        }
    };
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:17,代码来源:Sensors.java

示例2: runOpMode

import com.qualcomm.robotcore.hardware.DigitalChannel; //导入方法依赖的package包/类
@Override
public void runOpMode() {

  boolean               inputPin;             // Input State
  boolean               outputPin;            // Output State
  DeviceInterfaceModule dim;                  // Device Object
  DigitalChannel        digIn;                // Device Object
  DigitalChannel        digOut;               // Device Object

  // get a reference to a Modern Robotics DIM, and IO channels.
  dim = hardwareMap.get(DeviceInterfaceModule.class, "dim");   //  Use generic form of device mapping
  digIn  = hardwareMap.get(DigitalChannel.class, "digin");     //  Use generic form of device mapping
  digOut = hardwareMap.get(DigitalChannel.class, "digout");    //  Use generic form of device mapping

  digIn.setMode(DigitalChannelController.Mode.INPUT);          // Set the direction of each channel
  digOut.setMode(DigitalChannelController.Mode.OUTPUT);

  // wait for the start button to be pressed.
  telemetry.addData(">", "Press play, and then user X button to set DigOut");
  telemetry.update();
  waitForStart();

  while (opModeIsActive())  {

      outputPin = gamepad1.x ;        //  Set the output pin based on x button
      digOut.setState(outputPin);
      inputPin = digIn.getState();    //  Read the input pin

      // Display input pin state on LEDs
      if (inputPin) {
          dim.setLED(RED_LED_CHANNEL, true);
          dim.setLED(BLUE_LED_CHANNEL, false);
      }
      else {
          dim.setLED(RED_LED_CHANNEL, false);
          dim.setLED(BLUE_LED_CHANNEL, true);
      }

      telemetry.addData("Output", outputPin );
      telemetry.addData("Input", inputPin );
      telemetry.addData("LED",   inputPin ? "Red" : "Blue" );
      telemetry.update();
  }
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:45,代码来源:SensorDIO.java

示例3: runOpMode

import com.qualcomm.robotcore.hardware.DigitalChannel; //导入方法依赖的package包/类
@Override
public void runOpMode() {

  boolean               inputPin;             // Input State
  boolean               outputPin;            // Output State
  DeviceInterfaceModule dim;                  // Device Object
  DigitalChannel        digIn;                // Device Object
  DigitalChannel        digOut;               // Device Object

  // get a reference to a Modern Robotics DIM, and IO channels.
  dim = hardwareMap.get(DeviceInterfaceModule.class, "dim");   //  Use generic form of device mapping
  digIn  = hardwareMap.get(DigitalChannel.class, "digin");     //  Use generic form of device mapping
  digOut = hardwareMap.get(DigitalChannel.class, "digout");    //  Use generic form of device mapping

  digIn.setMode(DigitalChannel.Mode.INPUT);          // Set the direction of each channel
  digOut.setMode(DigitalChannel.Mode.OUTPUT);

  // wait for the start button to be pressed.
  telemetry.addData(">", "Press play, and then user X button to set DigOut");
  telemetry.update();
  waitForStart();

  while (opModeIsActive())  {

      outputPin = gamepad1.x ;        //  Set the output pin based on x button
      digOut.setState(outputPin);
      inputPin = digIn.getState();    //  Read the input pin

      // Display input pin state on LEDs
      if (inputPin) {
          dim.setLED(RED_LED_CHANNEL, true);
          dim.setLED(BLUE_LED_CHANNEL, false);
      }
      else {
          dim.setLED(RED_LED_CHANNEL, false);
          dim.setLED(BLUE_LED_CHANNEL, true);
      }

      telemetry.addData("Output", outputPin );
      telemetry.addData("Input", inputPin );
      telemetry.addData("LED",   inputPin ? "Red" : "Blue" );
      telemetry.update();
  }
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:45,代码来源:SensorDIO.java

示例4: runOpMode

import com.qualcomm.robotcore.hardware.DigitalChannel; //导入方法依赖的package包/类
@Override
public void runOpMode() throws InterruptedException {

    boolean inputPin;             // Input State
    boolean outputPin;            // Output State
    DeviceInterfaceModule dim;                  // Device Object
    DigitalChannel digIn;                // Device Object
    DigitalChannel digOut;               // Device Object

    // get a reference to a Modern Robotics DIM, and IO channels.
    dim = hardwareMap.get(DeviceInterfaceModule.class, "dim");   //  Use generic form of device mapping
    digIn = hardwareMap.get(DigitalChannel.class, "digin");     //  Use generic form of device mapping
    digOut = hardwareMap.get(DigitalChannel.class, "digout");    //  Use generic form of device mapping

    digIn.setMode(DigitalChannelController.Mode.INPUT);          // Set the direction of each channel
    digOut.setMode(DigitalChannelController.Mode.OUTPUT);

    // wait for the start button to be pressed.
    telemetry.addData(">", "Press play, and then user X button to set DigOut");
    telemetry.update();
    waitForStart();

    while (opModeIsActive()) {

        outputPin = gamepad1.x;        //  Set the output pin based on x button
        digOut.setState(outputPin);
        inputPin = digIn.getState();    //  READ the input pin

        // Display input pin state on LEDs
        if (inputPin) {
            dim.setLED(RED_LED_CHANNEL, true);
            dim.setLED(BLUE_LED_CHANNEL, false);
        } else {
            dim.setLED(RED_LED_CHANNEL, false);
            dim.setLED(BLUE_LED_CHANNEL, true);
        }

        telemetry.addData("Output", outputPin);
        telemetry.addData("Input", inputPin);
        telemetry.addData("LED", inputPin ? "Red" : "Blue");
        telemetry.update();
    }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:44,代码来源:SensorDIO.java


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