예제 #1
0
  /**
   * Implement this method to define the code to run when the Start button is pressed on the Driver
   * station. This method will be called on each hardware cycle just as the loop() method is called
   * for event based Opmodes
   *
   * @throws InterruptedException
   */
  @Override
  protected void activeLoop() throws InterruptedException {

    // run motor full power (1) until the touch sensor is pressed
    if (motorToTouch.runToTarget(1)) {
      setOperationsCompleted();
    }

    // send any telemetry that may have been added in the above operations
    getTelemetryUtil().sendTelemetry();
  }
예제 #2
0
  /**
   * Implement this method to define the code to run when the Init button is pressed on the Driver
   * station.
   */
  @Override
  protected void onInit() {

    robot = MyFirstBot.newConfig(hardwareMap, getTelemetryUtil());

    // create an operation to control a motor from a touch sensor
    motorToTouch = new MotorToTouch("motor1", this, robot.getMotor1(), robot.getTouch());
    motorToTouch.setOpModeLogLevel(1);

    // Note The Telemetry Utility is designed to let you organize all telemetry data before sending
    // it to
    // the Driver station via the sendTelemetry command
    getTelemetryUtil().addData("Init", getClass().getSimpleName() + " initialized.");
    getTelemetryUtil().sendTelemetry();
  }