本文整理汇总了Java中edu.wpi.first.wpilibj.buttons.Button类的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于edu.wpi.first.wpilibj.buttons包,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OI
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public OI() {
leftController.setDeadband(0.2);
rightController.setDeadband(0.2);
//Catapult
Button launch = new JoystickButton(leftController, XboxController.RightBumper);
//Button autoAim = new JoystickButton(driveController, XboxController.Start);
Button lockLatch = new JoystickButton(leftController, XboxController.LeftBumper);
Button LaunchGroup = new JoystickButton(leftController, XboxController.Back);
launch.whenPressed(new Launch());
lockLatch.whenPressed(new LockLatch());
//autoAim.whenPressed(new AutoAim());
LaunchGroup.whenPressed(new LaunchGroup());
//Intake
Button lowerIntake = new JoystickButton(leftController, XboxController.X);
Button raiseIntake = new JoystickButton(leftController, XboxController.Y);
Button posCatForLoad = new JoystickButton(leftController, XboxController.B);
Button posCatForLaunch = new JoystickButton(leftController, XboxController.A);
lowerIntake.whenPressed(new LowerIntake());
raiseIntake.whenPressed(new RaiseIntake());
posCatForLoad.whenPressed(new PosCatForLoad());
posCatForLaunch.whenPressed(new PosCatForLaunch()) ;
// //Driving
// Button switchDirection = new JoystickButton(driveController, XboxController.Start);
// switchDirection.whenPressed(new SwitchDirection());
}
示例2: OI
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public OI() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
functionJoystick = new Joystick(1);
driverJoystick = new Joystick(0);
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
SmartDashboard.putData("Reset encoder", new ResetEncoder());
SmartDashboard.putData("Reset encoder", new ResetGyro());
Button armsMoveIn = new JoystickButton(functionJoystick, 1); // A button
Button armsMoveOut = new JoystickButton(functionJoystick, 2); // B button
Button boomUp = new JoystickButton(functionJoystick, 3);
Button boomDown = new JoystickButton(functionJoystick, 4);
Button rcUp = new JoystickButton(functionJoystick, 6);
Button rcDown = new JoystickButton(functionJoystick, 5);
armsMoveIn.whileHeld(new ArmCommand(true));
armsMoveOut.whileHeld(new ArmCommand(false));
boomUp.whileHeld(new ElevatorCommand(true, false));
boomUp.whenReleased(new ElevatorCommand(true, true));
boomDown.whileHeld(new ElevatorCommand(false, false));
boomDown.whenReleased(new ElevatorCommand(false, true));
rcUp.whileHeld(new RecycleContainerCommand(true, false));
rcUp.whenReleased(new RecycleContainerCommand(true, true));
rcDown.whileHeld(new RecycleContainerCommand(false, false));
rcDown.whenReleased(new RecycleContainerCommand(false, true));
}
示例3: getLT
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getLT()
{
return new Button() {
@Override
public boolean get() {
return getLeftTriggerAxis() > .5;
}
};
}
示例4: getRT
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getRT()
{
return new Button() {
@Override
public boolean get() {
return getRightTriggerAxis() > .5;
}
};
}
示例5: getUp
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getUp()
{
return new Button() {
@Override
public boolean get()
{
return getPOV() == 0;
}
};
}
示例6: getRight
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getRight()
{
return new Button() {
@Override
public boolean get()
{
return getPOV() == 90;
}
};
}
示例7: getDown
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getDown()
{
return new Button() {
@Override
public boolean get()
{
return getPOV() == 180;
}
};
}
示例8: getLeft
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getLeft()
{
return new Button() {
@Override
public boolean get()
{
return getPOV() == 270;
}
};
}
示例9: OI
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public OI(){
leftStick = new Joystick(1);
rightStick = new Joystick(2);
Button leftShift = new JoystickButton(leftStick, 1);
Button rightShift = new JoystickButton(rightStick, 1);
leftShift.whenPressed(new Shift());
rightShift.whenPressed(new Shift());
}
示例10: OI
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public OI() {
xbox = new Joystick(JOYSTICK_PORT);
Button a = new JoystickButton(xbox, BUTTON_A);
Button rb = new JoystickButton(xbox, BUTTON_RB);
a.whenPressed(new FireCommand());
rb.whenPressed(new ReloadCommand());
}
示例11: CommandWaitForButton
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public CommandWaitForButton(Button button) {
super(null);
b = button;
}
示例12: setCancelWhenReleased
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public final Command5800 setCancelWhenReleased(Button button) {
isWhileHeld = true;
this.button = button;
return this;
}
示例13: getX2
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getX2()
{
return new JoystickButton(this, x);
}
示例14: getY2
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getY2()
{
return new JoystickButton(this, y);
}
示例15: getA
import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getA()
{
return new JoystickButton(this, a);
}