package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
@TeleOp
public class DualDrive extends LinearOpMode {
// Register motors
private DcMotor rightmotor;
private DcMotor leftmotor;
// Register timer
private ElapsedTime runtime;
@Override
public void runOpMode() {
// Connect motors to the robot
rightmotor = hardwareMap.get(DcMotor.class, "rightmotor");
leftmotor = hardwareMap.get(DcMotor.class, "leftmotor");
// Fixing right motor two share same direction as the left one
rightmotor.setDirection(DcMotorSimple.Direction.REVERSE);
waitForStart();
// Loop when the program is ON
while (opModeIsActive()) {
while (runtime.seconds() >= 3 && runtime.seconds() < 6) {
leftmotor.setPower(1);
rightmotor.setPower(1);
}
}
}
}