Skip to content

Commit

Permalink
Hold arm in position attempt #1
Browse files Browse the repository at this point in the history
  • Loading branch information
acastellar committed Feb 4, 2022
1 parent 3b48182 commit 150ba46
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@TeleOp(name = "Lil Main Drive")
public class Lilboi extends LinearOpMode {

private int position = 0;

@Override
public void runOpMode() throws InterruptedException {

Expand All @@ -24,7 +26,10 @@ public void runOpMode() throws InterruptedException {
//set motor direction
motorFrontLeft.setDirection(DcMotorSimple.Direction.REVERSE);
motorBackRight.setDirection(DcMotorSimple.Direction.REVERSE);

// Setup shoulder
shoulderMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
shoulderMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION);

waitForStart();

Expand Down Expand Up @@ -58,8 +63,10 @@ public void runOpMode() throws InterruptedException {

if(gamepad1.dpad_up){
shoulderPower = 0.5;
position += 20;
}else if(gamepad1.dpad_down){
shoulderPower = -0.5;
position += 20;
}else{
shoulderPower = 0;
}
Expand All @@ -72,6 +79,7 @@ public void runOpMode() throws InterruptedException {
elbowPower = 0;
}

shoulderMotor.setTargetPosition(position);
shoulderMotor.setPower(shoulderPower);
elbowMotor.setPower(elbowPower);
spinMotor.setPower(spin);
Expand Down

0 comments on commit 150ba46

Please sign in to comment.