Skip to content

Commit

Permalink
Continuously rotates servo when you stop pressing button.
Browse files Browse the repository at this point in the history
  • Loading branch information
abirarun committed Oct 21, 2024
1 parent b684a79 commit 7c20a68
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class FieldCentricBlue
IntegratingGyroscope gyro;
NavxMicroNavigationSensor navxMicro;
ElapsedTime timer = new ElapsedTime();

// this is code is code you know what code it is i like coding yippee code epic epic epic epic for robot straferbot coiding code
@Override
public void runOpMode() throws InterruptedException {
Expand All @@ -67,7 +68,7 @@ public void runOpMode() throws InterruptedException {
navxMicro = hardwareMap.get(NavxMicroNavigationSensor.class, "gyro");
gyro = (IntegratingGyroscope) navxMicro;

RevBlinkinLedDriver lights = hardwareMap.get(RevBlinkinLedDriver.class,"lights");
RevBlinkinLedDriver lights = hardwareMap.get(RevBlinkinLedDriver.class, "lights");

DistanceSensor sensor = hardwareMap.get(DistanceSensor.class, "distance");
telemetry.log().add("Gyro Calibrating. Do Not Move!");
Expand All @@ -88,9 +89,9 @@ public void runOpMode() throws InterruptedException {

waitForStart();
telemetry.log().clear();
if(gamepad2.a)
if (gamepad2.a)
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.RED);
if(gamepad2.b)
if (gamepad2.b)
lights.setPattern(RevBlinkinLedDriver.BlinkinPattern.BLUE);
if (isStopRequested()) return;
double distance = 100;
Expand Down Expand Up @@ -143,7 +144,7 @@ public void runOpMode() throws InterruptedException {
hardware.backRight.setPower(backRightPower / 2);


double color= 15;
double color = 15;
distance = sensor.getDistance(INCH);
// telemetry.addData("distance", distance);
// telemetry.addData("color",color);
Expand All @@ -162,22 +163,20 @@ public void runOpMode() throws InterruptedException {
.addData("pitch", "%s deg", formatAngle(angles.angleUnit, angles.thirdAngle));
telemetry.update();
*/
// handservo(1.0);
// handservo(1.0);
display(1);
blinkin(1);
if(gamepad1.dpad_down)
if (gamepad1.dpad_down)
crservo(90);





//gamepad controls here.
idle();

}

}

private void initAprilTag() {

// Create the AprilTag processor.
Expand All @@ -189,9 +188,6 @@ private void initAprilTag() {
VisionPortal.Builder builder = new VisionPortal.Builder();





// Set the camera (webcam vs. built-in RC phone camera).
if (USE_WEBCAM) {
builder.setCamera(hardwareMap.get(WebcamName.class, "Webcam 1"));
Expand All @@ -208,6 +204,7 @@ private void initAprilTag() {
visionPortal = builder.build();

}

@SuppressLint("DefaultLocale")
private void telemetryAprilTag() {

Expand Down Expand Up @@ -251,6 +248,7 @@ String formatAngle(AngleUnit angleUnit, double angle) {
String formatDegrees(double degrees) {
return String.format("%.1f", AngleUnit.DEGREES.normalize(degrees));
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// public void turn(double target) {
Expand Down Expand Up @@ -327,6 +325,7 @@ public void crservo(double deltaAngle){
if(gamepad1.b){
con_servo.setPower(0);
}

}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7c20a68

Please sign in to comment.