当前位置: 首页>>代码示例>>Java>>正文


Java Button.whenPressed方法代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.buttons.Button.whenPressed方法的典型用法代码示例。如果您正苦于以下问题:Java Button.whenPressed方法的具体用法?Java Button.whenPressed怎么用?Java Button.whenPressed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.first.wpilibj.buttons.Button的用法示例。


在下文中一共展示了Button.whenPressed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
    }
 
开发者ID:frc3946,项目名称:Stronghold,代码行数:29,代码来源:OI.java

示例2: 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());
}
 
开发者ID:steelhawks,项目名称:ProjectShifter,代码行数:9,代码来源:OI.java

示例3: 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());
}
 
开发者ID:SaintsRobotics,项目名称:TreeShirtCannon-2015,代码行数:8,代码来源:OI.java

示例4: OI

import edu.wpi.first.wpilibj.buttons.Button; //导入方法依赖的package包/类
public OI() {
    xbox = new Joystick(JOYSTICK_PORT);
    Button a = new JoystickButton(xbox, BUTTON_A);
    a.whenPressed(new TurnToFaceTapeCommand());
}
 
开发者ID:SaintsRobotics,项目名称:Vision,代码行数:6,代码来源:OI.java

示例5: init

import edu.wpi.first.wpilibj.buttons.Button; //导入方法依赖的package包/类
public void init() {
    primaryXboxController = new Joystick(PRIMARY_JOY);
    secondaryXboxController = new Joystick(SECONDARY_JOY);

    ALLIANCE_COLOR = DriverStation.getInstance().getAlliance().value;
    SmartDashboard.putBoolean("Alliance", ALLIANCE_COLOR == DriverStation.Alliance.kBlue_val);

    preferencesManagers = BadPreferences.getInstance();

    //button that senses seconadry Right bumper press for shooter injection
    /*if (CommandBase.frisbeePusher != null)
     {
     Button injectFrisbee = new Button() {
     public boolean get()
     {
     return (secondaryXboxController.getRawButton(RB));
     }
     };
     injectFrisbee.whenPressed(new InjectFrisbee());   
     }*/

    //press A to climb
    //if (CommandBase.climberArticulator != null) {

        Button climb = new Button() {
            public boolean get() {
                return (OI.getPrimaryRightTrigger() > 0);
            }
        };
        climb.whenPressed(new ClimbForTenPoints());
    //}
    
    if (CommandBase.shooterArticulator != null)
    {
        Button aim = new Button()
        {
            public boolean get()
            {
                return (isPrimaryYButtonPressed());
            }
        };
        aim.whenPressed(new AimWithCamera());
    }
    
    
    if (!this.CONSOLE_OUTPUT_ENABLED) {
        System.out.println("Console output has been disabled from OI");
    }
}
 
开发者ID:BadRobots1014,项目名称:BadRobot2013,代码行数:50,代码来源:OI.java

示例6: registerWhenPressedCommand

import edu.wpi.first.wpilibj.buttons.Button; //导入方法依赖的package包/类
/**
 * Register button to command
 * 
 * @param b
 *            button to register command to
 * 
 * @param c
 *            command to register to button
 */
public static void registerWhenPressedCommand(Button b, Command c) {
	b.whenPressed(c);
}
 
开发者ID:Team2537,项目名称:Cogsworth,代码行数:13,代码来源:HumanInput.java


注:本文中的edu.wpi.first.wpilibj.buttons.Button.whenPressed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。