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


Java Button类代码示例

本文整理汇总了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());
    }
 
开发者ID:frc3946,项目名称:Stronghold,代码行数:29,代码来源:OI.java

示例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));
}
 
开发者ID:FRC-5506,项目名称:RecycleRush,代码行数:36,代码来源:OI.java

示例3: getLT

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getLT()
{
	return new Button() {
		
		@Override
		public boolean get() {
			return getLeftTriggerAxis() > .5;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:11,代码来源:LogitechF310.java

示例4: getRT

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getRT()
{
	return new Button() {
				
		@Override
		public boolean get() {
			return getRightTriggerAxis() > .5;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:11,代码来源:LogitechF310.java

示例5: getUp

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getUp()
{
	return new Button() {
		
		@Override
		public boolean get()
		{
			return getPOV() == 0;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:12,代码来源:LogitechF310.java

示例6: getRight

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getRight()
{
	return new Button() {
		
		@Override
		public boolean get()
		{
			return getPOV() == 90;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:12,代码来源:LogitechF310.java

示例7: getDown

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getDown()
{
	return new Button() {
		
		@Override
		public boolean get()
		{
			return getPOV() == 180;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:12,代码来源:LogitechF310.java

示例8: getLeft

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getLeft()
{
	return new Button() {
		
		@Override
		public boolean get()
		{
			return getPOV() == 270;
		}
	};
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:12,代码来源:LogitechF310.java

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

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

示例11: CommandWaitForButton

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public CommandWaitForButton(Button button) {
	super(null);
	b = button;
}
 
开发者ID:FRC5800,项目名称:FRC-5800-Stronghold,代码行数:5,代码来源:CommandWaitForButton.java

示例12: setCancelWhenReleased

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public final Command5800 setCancelWhenReleased(Button button) {
	isWhileHeld = true;
	this.button = button;
	return this;
}
 
开发者ID:FRC5800,项目名称:FRC-5800-Stronghold,代码行数:6,代码来源:Command5800.java

示例13: getX2

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getX2()
{
	return new JoystickButton(this, x);
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:5,代码来源:LogitechF310.java

示例14: getY2

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getY2()
{
	return new JoystickButton(this, y);
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:5,代码来源:LogitechF310.java

示例15: getA

import edu.wpi.first.wpilibj.buttons.Button; //导入依赖的package包/类
public Button getA()
{
	return new JoystickButton(this, a);
}
 
开发者ID:246overclocked,项目名称:scorpion,代码行数:5,代码来源:LogitechF310.java


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