當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。