Skip to content

Commit

Permalink
LED lights turn on when buttons A and B on gamepad two are pressed(pr…
Browse files Browse the repository at this point in the history
…ess x at the same time)
  • Loading branch information
abirarun committed Oct 13, 2024
1 parent c5257b6 commit 2c49c16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ public void runOpMode() throws InterruptedException {
telemetry.update();
*/
handservo(1.0);
display(1);

if(gamepad1.dpad_down)
crservo(90);


if (gamepad1.dpad_up) {
straightline(0.3, 24.0, 0.0);
Expand All @@ -178,15 +183,12 @@ public void runOpMode() throws InterruptedException {
if (gamepad1.a) {
turn2(-90);
}
if (gamepad1.dpad_down) {
crservo(90);
}

if (gamepad2.x){
blinkin(1);
}
if (gamepad2.y){
display(1);
}


//Rumble();
//gamepad controls here.
idle();
Expand Down Expand Up @@ -323,7 +325,7 @@ public void turn(double target) {
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void crservo(double deltaAngle){
public void crservo(double deltaAngle){
con_servo=hardwareMap.crservo.get("intakeServo");
waitForStart();
while (opModeIsActive()){
Expand Down Expand Up @@ -483,20 +485,20 @@ public void display (double color){
double red = ribbit.red();
double blue = ribbit.blue();
double green = ribbit.green();
boolean rred = red - blue > 100 && red - green > 100;
boolean bblue = blue - green > 100 && blue - red > 100;
boolean rred = ((red - blue > 100) && (red - green > 100));
boolean bblue = ((blue - green > 100) && (blue - red > 100));
//boolean ggreen = green != 0;
boolean yellow = ((green - blue) > 100) && ((green - red) > 100) && (red >= 350);

if (rred){
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.RED);
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.RAINBOW_LAVA_PALETTE);
}
else{
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.BLACK);
}

if(bblue){
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.BLUE);
if(bblue) {
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.RAINBOW_OCEAN_PALETTE);
}
else {
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.BLACK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public StraferHardware(HardwareMap map) {
@HardwareName("frontLeft")
@AutoClearEncoder
@ZeroPower(DcMotor.ZeroPowerBehavior.BRAKE)
@Reversed
public DcMotor frontLeft;

@HardwareName("distance")
Expand Down

0 comments on commit 2c49c16

Please sign in to comment.