Skip to content

Commit

Permalink
i want ti eT RED 40
Browse files Browse the repository at this point in the history
  • Loading branch information
ieatred40 committed Oct 2, 2024
1 parent c41a5b0 commit 6233340
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.firstinspires.ftc.teamcode.opmode;

import com.acmerobotics.dashboard.config.Config;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;

@Config

@TeleOp
public class LearningTeleOpfor17334 extends LinearOpMode {
private DcMotor leftFrontMotor;
private DcMotor rightFrontMotor;
private DcMotor leftBackMotor;

@Override
public void runOpMode() throws InterruptedException {

leftFrontMotor = hardwareMap.get(DcMotor.class, "left_front_left_dw");
rightFrontMotor = hardwareMap.get(DcMotor.class, "right_front");
waitForStart();
while(opModeIsActive()){
if (gamepad1.right_stick_y>=0.1) {
leftFrontMotor.setPower(1);
rightFrontMotor.setPower(-1);
} else if (gamepad1.right_stick_y<=-0.1) {
leftFrontMotor.setPower(-1);
rightFrontMotor.setPower(1);
} else {
leftFrontMotor.setPower(0);
rightFrontMotor.setPower(0);

}


}




}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.firstinspires.ftc.teamcode.opmode.components;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.hardware.ServoController;

import org.firstinspires.ftc.robotcore.internal.camera.delegating.DelegatingCaptureSequence;


@TeleOp

public class TrumanLearnsTeleOP extends LinearOpMode {
private DcMotor topLeftMotor;
private DcMotor topRightMotor;
private DcMotor bottomLeftMotor;
private DcMotor bottomRightMotor;
private CRServo tail;
@Override
public void runOpMode() throws InterruptedException {
float ly;
float lx;
float rx;
topLeftMotor = hardwareMap.get(DcMotor.class,"FL");
topRightMotor = hardwareMap.get(DcMotor.class,"FR");
bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL");
bottomRightMotor = hardwareMap.get(DcMotor.class,"BR");
topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
//tail = hardwareMap.get(CRServo.class,"servo"); ONLY FOR DOG
int tailAngle = 1;
double motorSpeed = 0.3;
waitForStart();
while (opModeIsActive()){
lx=gamepad1.left_stick_x;
ly=gamepad1.left_stick_y;
rx=gamepad1.right_stick_x;
topLeftMotor.setPower((ly-lx-rx)*motorSpeed);
// topRightMotor.setPower((ly-lx-rx)*motorSpeed);
// bottomLeftMotor.setPower((ly-lx+rx)*motorSpeed);
// bottomRightMotor.setPower((-rx+lx+ly)*motorSpeed);
/*
if (gamepad1.a) {
tail.setDirection(DcMotorSimple.Direction.FORWARD);
}
else {
tail.setDirection(DcMotorSimple.Direction.REVERSE);
}
*/
// System.out.println();
}
}
}

0 comments on commit 6233340

Please sign in to comment.