-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pickup.java
54 lines (38 loc) · 1.14 KB
/
Pickup.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
package org.firstinspires.ftc.teamcode.Subsystems;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.HardwareMap;
/**
* Created by John Paul Ashour on 11/12/2016.
*/
public class Pickup {
public DcMotor Pickup = null;
private enum pickupEnum {Run, Reverse, Stop}
pickupEnum PickupState =pickupEnum.Stop;
public Pickup(String Pickup, HardwareMap hardwareMap) {
this.Pickup = hardwareMap.dcMotor.get(Pickup);
}
public void run() {
Pickup.setPower(1.0);
PickupState = pickupEnum.Run;
}
public void stop() {
Pickup.setPower(0);
PickupState = pickupEnum.Stop;
}
public void reverse(){
Pickup.setPower(-1.0);
PickupState = pickupEnum.Reverse;
}
@Override
public String toString() {
switch (PickupState){
case Run:
return "Running";
case Stop:
return "Stopped";
default:
return "Unknown";
}
}
}