Skip to content

Commit 6233340

Browse files
committed
i want ti eT RED 40
1 parent c41a5b0 commit 6233340

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.firstinspires.ftc.teamcode.opmode;
2+
3+
import com.acmerobotics.dashboard.config.Config;
4+
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
5+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
6+
import com.qualcomm.robotcore.hardware.DcMotor;
7+
8+
@Config
9+
10+
@TeleOp
11+
public class LearningTeleOpfor17334 extends LinearOpMode {
12+
private DcMotor leftFrontMotor;
13+
private DcMotor rightFrontMotor;
14+
private DcMotor leftBackMotor;
15+
16+
@Override
17+
public void runOpMode() throws InterruptedException {
18+
19+
leftFrontMotor = hardwareMap.get(DcMotor.class, "left_front_left_dw");
20+
rightFrontMotor = hardwareMap.get(DcMotor.class, "right_front");
21+
waitForStart();
22+
while(opModeIsActive()){
23+
if (gamepad1.right_stick_y>=0.1) {
24+
leftFrontMotor.setPower(1);
25+
rightFrontMotor.setPower(-1);
26+
} else if (gamepad1.right_stick_y<=-0.1) {
27+
leftFrontMotor.setPower(-1);
28+
rightFrontMotor.setPower(1);
29+
} else {
30+
leftFrontMotor.setPower(0);
31+
rightFrontMotor.setPower(0);
32+
33+
}
34+
35+
36+
}
37+
38+
39+
40+
41+
}
42+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package org.firstinspires.ftc.teamcode.opmode.components;
2+
3+
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
4+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
5+
import com.qualcomm.robotcore.hardware.CRServo;
6+
import com.qualcomm.robotcore.hardware.DcMotor;
7+
import com.qualcomm.robotcore.hardware.DcMotorSimple;
8+
import com.qualcomm.robotcore.hardware.Servo;
9+
import com.qualcomm.robotcore.hardware.ServoController;
10+
11+
import org.firstinspires.ftc.robotcore.internal.camera.delegating.DelegatingCaptureSequence;
12+
13+
14+
@TeleOp
15+
16+
public class TrumanLearnsTeleOP extends LinearOpMode {
17+
private DcMotor topLeftMotor;
18+
private DcMotor topRightMotor;
19+
private DcMotor bottomLeftMotor;
20+
private DcMotor bottomRightMotor;
21+
private CRServo tail;
22+
@Override
23+
public void runOpMode() throws InterruptedException {
24+
float ly;
25+
float lx;
26+
float rx;
27+
topLeftMotor = hardwareMap.get(DcMotor.class,"FL");
28+
topRightMotor = hardwareMap.get(DcMotor.class,"FR");
29+
bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL");
30+
bottomRightMotor = hardwareMap.get(DcMotor.class,"BR");
31+
topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
32+
bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
33+
//tail = hardwareMap.get(CRServo.class,"servo"); ONLY FOR DOG
34+
int tailAngle = 1;
35+
double motorSpeed = 0.3;
36+
waitForStart();
37+
while (opModeIsActive()){
38+
lx=gamepad1.left_stick_x;
39+
ly=gamepad1.left_stick_y;
40+
rx=gamepad1.right_stick_x;
41+
topLeftMotor.setPower((ly-lx-rx)*motorSpeed);
42+
// topRightMotor.setPower((ly-lx-rx)*motorSpeed);
43+
// bottomLeftMotor.setPower((ly-lx+rx)*motorSpeed);
44+
// bottomRightMotor.setPower((-rx+lx+ly)*motorSpeed);
45+
/*
46+
if (gamepad1.a) {
47+
tail.setDirection(DcMotorSimple.Direction.FORWARD);
48+
}
49+
else {
50+
tail.setDirection(DcMotorSimple.Direction.REVERSE);
51+
}
52+
53+
*/
54+
// System.out.println();
55+
}
56+
}
57+
}
58+

0 commit comments

Comments
 (0)