Java DigitalChannel.setMode方法代码示例(javadigitalchannel.setmode典型用法代码示例汇总)

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


Java DigitalChannel.setMode方法代码示例(javadigitalchannel.setmode典型用法代码示例汇总)

在下文中一共展示了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

本文标签属性:

示例:示例志愿表

代码:代码零九

java:java模拟器

DigitalChannel:digitalchanneldc122

setMode:setMode

上一篇:张桂梅送别入伍新兵(关于张桂梅送别入伍新兵的2个问题)
下一篇:卢卡申科是谁?(卢卡申科是独载者吗)

为您推荐