-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from technototes/main
keep up to date
- Loading branch information
Showing
6 changed files
with
103 additions
and
42 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
TeachCode/src/main/java/org/firstinspires/ftc/teachcode/DemoOpMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.firstinspires.ftc.teachcode; | ||
|
||
|
||
|
||
import com.qualcomm.robotcore.eventloop.opmode.OpMode; | ||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp; | ||
import com.qualcomm.robotcore.hardware.DcMotorEx; | ||
|
||
@TeleOp(name = "DemoOpMode") | ||
public class DemoOpMode extends OpMode { | ||
|
||
@Override | ||
public void init() { | ||
|
||
} | ||
|
||
@Override | ||
public void loop() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
TeachCode/src/main/java/org/firstinspires/ftc/teachcode/OpModes/StickTankDriveForVideo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.firstinspires.ftc.teachcode.OpModes; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.OpMode; | ||
import com.qualcomm.robotcore.hardware.DcMotorEx; | ||
import com.qualcomm.robotcore.hardware.DcMotorSimple; | ||
import com.qualcomm.robotcore.hardware.Gamepad; | ||
|
||
import org.firstinspires.ftc.teachcode.TankDriveDemo; | ||
|
||
@com.qualcomm.robotcore.eventloop.opmode.TeleOp(name = "StickTankDriveForVideo") | ||
|
||
public class StickTankDriveForVideo extends OpMode { | ||
|
||
private static final double DEAD_ZONE = 0.1; | ||
private TankDriveDemo tankDrive; | ||
private DcMotorEx motorL; | ||
private DcMotorEx motorR; | ||
|
||
@Override | ||
public void init() { | ||
motorL = hardwareMap.get(DcMotorEx.class, "motorL"); | ||
motorR = hardwareMap.get(DcMotorEx.class, "motorR"); | ||
motorR.setDirection(DcMotorSimple.Direction.REVERSE); | ||
tankDrive = new TankDriveDemo(motorL, motorR); | ||
} | ||
|
||
@Override | ||
public void loop() { | ||
if (Math.abs(gamepad1.left_stick_y) > DEAD_ZONE) { | ||
tankDrive.motorLPower(gamepad1.left_stick_y); | ||
} else { | ||
tankDrive.motorLPower(0); | ||
} | ||
if (Math.abs(gamepad1.right_stick_y) > DEAD_ZONE) { | ||
tankDrive.motorRPower(gamepad1.right_stick_y); | ||
} else { | ||
tankDrive.motorRPower(0); | ||
} | ||
} | ||
|
||
@Override | ||
public void start() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters