Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

added simplified touch sensor and servo code #49

Merged
merged 1 commit into from
Nov 8, 2023
Merged
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
@@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.<Servo>get("clawServo").setPosition(-0.25);
} else if (gamepad1.b) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}

Loading