-
Notifications
You must be signed in to change notification settings - Fork 1
/
ShooterAndCollecting.java
61 lines (45 loc) · 1.41 KB
/
ShooterAndCollecting.java
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.firstinspires.ftc.teamcode.Code;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
/**
* Created by Joanna and Gemma on 1/24/17.
*/
//recent
@TeleOp (name = "Green Shooter and Collector", group ="Green")
public class ShooterAndCollecting extends OpMode {
DcMotor shooter;
DcMotor collect;
private double speedcol = -2.0;
private double speedshoot = 0.6;
private double col = 0;
private double shooting = 0;
public void init() {
shooter = hardwareMap.dcMotor.get("sho");
collect = hardwareMap.dcMotor.get("co up");
telemetry.addData("Get started!", 6);
}
public void loop() {
telemetry.addData("Start the game", 4);
//code for collecting (press button x):
//if(gamepad1.x){
if (gamepad2.x) {
col = speedcol;
telemetry.addData("collecting", col);
collect.setPower(col);
} else {
col = 0;
collect.setPower(col);
}
//code for shooters(press botton y)
// if(gamepad1.y){
if (gamepad2.y) {
shooting = speedshoot;
telemetry.addData("Shooter", shooting);
shooter.setPower(shooting);
} else {
shooting = 0;
shooter.setPower(shooting);
}
}
}