Arcade Sürüş Programlama
Değişkenlerimiz oluşturuldu ve hareket anlaşıldı, şimdi sadece denklemlerimizi her güce eklememiz gerekiyor!
@Override
public void runOpMode() {
control_Hub = hardwareMap.get(Blinker.class, "Control Hub");
arm = hardwareMap.get(DcMotor.class, "arm");
leftmotor = hardwareMap.get(DcMotor.class, "leftmotor");
rightmotor = hardwareMap.get(DcMotor.class, "rightmotor");
test_motor = hardwareMap.get(DcMotor.class, "test_motor");
test_servo = hardwareMap.get(Servo.class, "test_servo");
test_touch = hardwareMap.get(TouchSensor.class, "test_touch");
rightmotor.setDirection(DcMotorSimple.Direction.REVERSE);
double x;
double y;
telemetry.addData("Status", "Initialized");
telemetry.update();
// Oyunun başlamasını bekleyin (sürücü PLAY'e basar)
waitForStart();
// maç bitene kadar çalışmaya devam et (sürücü STOP'a basar)
while (opModeIsActive()) {
x = gamepad1.right_stick_x;
y = -gamepad1.right_stick_y;
rightmotor.setPower(y - x);
leftmotor.setPower(y + x);
telemetry.addData("Status", "Running");
telemetry.update();
}
}Last updated