Establishing Variables in OnBot Java
Creating X and Y Variables:
public void runOpMode() {
rightmotor = hardwareMap.get(DcMotor.class, "rightmotor");
leftmotor = hardwareMap.get(DcMotor.class, "leftmotor");
rightmotor.setDirection(DcMotorSimple.Direction.REVERSE);
double x;
double y;
telemetry.addData("Status", "Initialized");
telemetry.update();
waitForStart();while (opModeIsActive()) {
x = gamepad1.right_stick_x;
y = -gamepad1.right_stick_y;
rightmotor.setPower(1);
leftmotor.setPower(1);
}What is a Variable?
When or Why do we use Variables?
Last updated
Was this helpful?

