diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/TouchSensorTest.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/TouchSensorTest.java new file mode 100644 index 00000000..f153f353 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auton/TouchSensorTest.java @@ -0,0 +1,18 @@ +package org.firstinspires.ftc.teamcode.auton; +import com.qualcomm.robotcore.eventloop.opmode.Autonomous; + +import com.qualcomm.robotcore.eventloop.opmode.OpMode; +import com.qualcomm.robotcore.hardware.TouchSensor; + +@Autonomous(name="Touch Sensor Test") +public class TouchSensorTest extends OpMode { + TouchSensor touch; + @Override + public void init() {} + + @Override + public void loop() { + touch = hardwareMap.touchSensor.get("touchSensor"); + telemetry.addData("Touch Sensor", touch.isPressed()); + } +} \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ClawCode.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ClawCode.java index f655fd35..e72699ed 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ClawCode.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ClawCode.java @@ -21,9 +21,10 @@ public void init() { robot.introduce(new HardwareElement<>(Servo.class, hardwareMap, "clawServo")); telemetry.addData("Status", "Initialized"); } + @Override public void loop() { - /** Rotating servos based on user input. */ + /* Rotating servos based on user input. */ if (gamepad1.a) { robot.get("clawServo").setPosition(-0.25); } else if (gamepad1.b) { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ServoTest.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ServoTest.java new file mode 100644 index 00000000..010eda4d --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/ServoTest.java @@ -0,0 +1,27 @@ +package org.firstinspires.ftc.teamcode.teleop; + +import com.qualcomm.robotcore.eventloop.opmode.OpMode; +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.Servo; + +@TeleOp(name = "Servo Test") +public class ServoTest extends OpMode { + Servo servoTest; + public void init() { + telemetry.addLine("Initializing"); + servoTest = hardwareMap.servo.get("clawServo"); + telemetry.addLine("Initialized"); + } + + public void loop() { + if (gamepad1.a) { + servoTest.setPosition(0); + } else if (gamepad1.b) { + servoTest.setPosition(0.25); + } + + telemetry.addData("Servo Port Number", servoTest.getPortNumber()); + telemetry.addData("Servo Position", servoTest.getPosition()); + } +} +