-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDigMotor.java
More file actions
47 lines (44 loc) · 1.56 KB
/
Copy pathDigMotor.java
File metadata and controls
47 lines (44 loc) · 1.56 KB
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
package com.walnuthillseagles.walnutlibrary;
import com.qualcomm.robotcore.hardware.DcMotor;
import java.util.ArrayList;
//Comment
/**
* Created by Yan Vologzhanin on 1/2/2016.
*/
public class DigMotor extends TeleMotor implements Drivable{
//Fields
//All available buttons... EVER (pls ;-;)
public enum digValues{
A1, B1, X1, Y1, BACK1, START1, GUIDE1, LEFT1,RIGHT1,
DOWN1, UP1,LBUMP1,RBUMP1,LSTICK1, RSTICK1,
A2, B2, X2, Y2, BACK2, START2, GUIDE2, LEFT2, RIGHT2,
DOWN2, UP2,LBUMP2, RBUMP2, LSTICK2, RSTICK2;
}
private ArrayList<ButtonEvent> Buttons;
//Constructors
//Create a forward and backward button event
private boolean isToggle;
public DigMotor(DcMotor myMotor, String myName, boolean encoderCheck, boolean myToggle){
//Create the motor
super(myMotor, myName, encoderCheck);
Buttons = new ArrayList<ButtonEvent>();
isToggle=myToggle;
}
public void addButton(String button, double power){
Buttons.add(new ButtonEvent(button, power));
}
//Teleop Methods
public void operate(){
ButtonEvent temp;
for(int i = 0;i<Buttons.size();i++){
temp = Buttons.get(i);
if(VirtualGamepad.boolValues[temp.getPos()]){
this.setPower(temp.getVal());
}
else if(!isToggle&&!VirtualGamepad.boolValues[temp.getPos()]){
this.fullStop();
}
}
}
//Autonomous Methods in Walnut Motor (Called "setPower(int pow)")
}