forked from vbatts/ftc-robot-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServoButton1.java
More file actions
30 lines (26 loc) · 886 Bytes
/
ServoButton1.java
File metadata and controls
30 lines (26 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.firstinspires.ftc.teamcode.ftc26358;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.Servo;
@TeleOp(group = "@Coaches Institute")
public class ServoButton1 extends OpMode {
public static final double CLAW_OPEN = 0.5;
public static final int CLAW_CLOSED = 0;
Servo servo;
@Override
public void init() {
telemetry.addData("Programmer", "Vincent");
servo = hardwareMap.get(Servo.class, "servo");
}
@Override
public void loop() {
double leftY = gamepad1.left_stick_y;
telemetry.addData("l_y", leftY);
if (gamepad1.y) {
servo.setPosition(CLAW_OPEN);
} else {
servo.setPosition(CLAW_CLOSED);
}
telemetry.addData("Servo Pos", servo.getPosition());
}
}