src/main/java/frc/robot/RobotContainer.java
private void configureButtonBindings() {
    m_DT.setDefaultCommand(m_Driving);

    new JoystickButton(m_XC, Constants.ForwardButton).whenPressed(() -> m_solenoidrelay.set(Value.kOn))
        .whenReleased(() -> m_solenoidrelay.set(Value.kOff));

    new JoystickButton(m_XC, Constants.LeftBumper).whenPressed(() -> m_cannonYaw.set(0.25))
        .whenReleased(() -> m_cannonYaw.set(0));

    new JoystickButton(m_XC, Constants.RightBumper).whenPressed(() -> m_cannonYaw.set(-0.25))
        .whenReleased(() -> m_cannonYaw.set(0));

    new JoystickButton(m_XC, Constants.AButtonID).whenPressed(() -> m_arduino.setToNumber(0,1));

    new JoystickButton(m_XC, 2).whenPressed(() -> m_arduino.setToNumber(1, 0));

    new JoystickButton(m_XC, 3).whenPressed(() -> m_arduino.setToNumber(1, 1));
    // new JoystickButton (m_XC, Constants.BackButton)
    // .whenPressed(() -> m_compressor.start())
    // .whenReleased(() -> m_compressor.stop());

  }
/**
   * Use this method to define your button->command mappings. Buttons can be
   * created by instantiating a {@link GenericHID} or one of its subclasses
   * ({@link edu.wpi.first.wpilibj.Joystick} or {@link XboxController}), and then
   * passing it to a {@link edu.wpi.first.wpilibj2.command.button.JoystickButton}.
   */
Use this method to define your button->command mappings. Buttons can be
created by instantiating a  GenericHID or one of its subclasses
( edu.wpi.first.wpilibj.Joystick or  XboxController), and then
passing it to a  edu.wpi.first.wpilibj2.command.button.JoystickButton.
Use this method to define your button - > command mappings . Buttons can be created by instantiating a GenericHID or one of its subclasses ( edu . wpi . first . wpilibj . Joystick or XboxController ) and then passing it to a edu . wpi . first . wpilibj2 . command . button . JoystickButton .
private void configureButtonBindings() {
    m_DT.setDefaultCommand(m_Driving);
    new JoystickButton(m_XC, Constants.ForwardButton).whenPressed(() -> m_solenoidrelay.set(Value.kOn))
        .whenReleased(() -> m_solenoidrelay.set(Value.kOff));
    new JoystickButton(m_XC, Constants.LeftBumper).whenPressed(() -> m_cannonYaw.set(0.25))
        .whenReleased(() -> m_cannonYaw.set(0));
    new JoystickButton(m_XC, Constants.RightBumper).whenPressed(() -> m_cannonYaw.set(-0.25))
        .whenReleased(() -> m_cannonYaw.set(0));
    new JoystickButton(m_XC, Constants.AButtonID).whenPressed(() -> m_arduino.setToNumber(0,1));
    new JoystickButton(m_XC, 2).whenPressed(() -> m_arduino.setToNumber(1, 0));
    new JoystickButton(m_XC, 3).whenPressed(() -> m_arduino.setToNumber(1, 1));
  }
private void configureButtonBindings ( ) { m_DT . setDefaultCommand ( m_Driving ) ; new JoystickButton ( m_XC , Constants . ForwardButton ) . whenPressed ( ( ) -> m_solenoidrelay . set ( Value . kOn ) ) . whenReleased ( ( ) -> m_solenoidrelay . set ( Value . kOff ) ) ; new JoystickButton ( m_XC , Constants . LeftBumper ) . whenPressed ( ( ) -> m_cannonYaw . set ( 0.25 ) ) . whenReleased ( ( ) -> m_cannonYaw . set ( 0 ) ) ; new JoystickButton ( m_XC , Constants . RightBumper ) . whenPressed ( ( ) -> m_cannonYaw . set ( - 0.25 ) ) . whenReleased ( ( ) -> m_cannonYaw . set ( 0 ) ) ; new JoystickButton ( m_XC , Constants . AButtonID ) . whenPressed ( ( ) -> m_arduino . setToNumber ( 0 , 1 ) ) ; new JoystickButton ( m_XC , 2 ) . whenPressed ( ( ) -> m_arduino . setToNumber ( 1 , 0 ) ) ; new JoystickButton ( m_XC , 3 ) . whenPressed ( ( ) -> m_arduino . setToNumber ( 1 , 1 ) ) ; }
Use this method to define your button->command mappings.
Use this method to define your button - > command mappings .
// new JoystickButton (m_XC, Constants.BackButton) // .whenPressed(() -> m_compressor.start()) // .whenReleased(() -> m_compressor.stop());