Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void runOpMode() throws InterruptedException {
// Preset Values 50, 70, 100
shooter.shooter50();
} else if (wasBPressed) {
shooter.shooter70();
//shooter.shooter70();
shooter.randomShooter();
} else if (wasYPressed) {
shooter.shooter100();
} else if (gamepad2.dpad_left || gamepad2.dpad_right) {
Expand Down
12 changes: 12 additions & 0 deletions TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.qualcomm.robotcore.hardware.Gamepad;
import com.qualcomm.robotcore.hardware.HardwareMap;
import org.firstinspires.ftc.robotcore.external.Telemetry;
import java.util.Random;

//Shooter class
public class Shooter {
Expand Down Expand Up @@ -67,6 +68,17 @@ public void shooter70() {
setMotorPower(this.shooterPower);
}

public void shooter(float power) {
this.shooterPower = power;
setMotorPower(this.shooterPower);
}

public void randomShooter() {
Random rand = new Random();
int n = rand.nextInt(100) + 1;
shooter(n);
}

public void reverseMotor() {
this.shooterPower = -1;
setMotorPower(this.shooterPower);
Expand Down