Instant Button Switching over proCONTROLL in Processing

Hi Everyone!
I edited this code in order to make it communicate over serial with my arduino but i’d like to enhance it with a little detail:
I have 3 servos and 4 inputs so i’d like to use a button (start button or maybe select button) on my xbox one controller to swich between two inputs (Lstick’s Y and the triggers, respectively in the code LposY and XBOXTrig).
The main work would be like sending the same letter and switching the listened slider in order to send less data to the arduino.

/* XBOX_USB_Serial.pde
 * This code hacks into the usb communication of the Xbox One
 * Controller that should be connected to your computer and by analysing the
 * position of the sticks and triggers on the controller as well as which buttons are pressed
 * and sends messages to an arduino that is connected via Serial.
 *External Dependencies: procontroll library (
 *Author: CodingAssassin
 *Editor: Juandellacalle
 *Version: 1.4
 *License: MIT Liscence

import processing.serial.*; // for communication via Serial
import procontroll.*;
import*; // internal dependency for procontroll

Serial myPort; // for communication with Arduino

ControllIO controll; // abstraction of the Controller object
ControllDevice device; // abstraction of the entire Xbox One Controller
ControllStick Lstick; // the left stick on the Xbox One Controller
ControllSlider Rstick; // the right stick on the Xbox One Controller
ControllCoolieHat DPad; // the Dpad
ControllSlider XBOXTrig; // the controller's triggers

float leftTriggerMultiplier, leftTriggerTolerance, leftTriggerTotalValue;
float rightTriggerMultiplier, rightTriggerTolerance, rightTriggerTotalValue;

ControllButton A;
ControllButton B;
ControllButton Y; 
ControllButton X;
ControllButton L1;
ControllButton L2;
ControllButton L3;
ControllButton R1;
ControllButton R2;
ControllButton R3;
ControllButton Select;
ControllButton Start;
ControllButton Up;
ControllButton Down;
ControllButton Left;
ControllButton Right;

void setup() {
  size(180, 180);

  // initiation
  controll = ControllIO.getInstance(this); // used to instantiate the controll object
  device = controll.getDevice("Controller (XBOX One For Windows)"); // ask the controll object for the Xbox One Controller
  // can check which serial ports are being used and by what
  // print all available sticks, sliders and buttons of the Xbox One Device

  // set average tolerance, to reduce jerks
  // initiating the sliders which make up the analog sticks
  ControllSlider LXslider = device.getSlider("x");
  ControllSlider LYslider = device.getSlider("y");
  ControllSlider RXslider = device.getSlider("x");

  // initating the sticks with the four sliders previously created
  Lstick = new ControllStick(device.getSlider(1), device.getSlider(0));

  // Identifying the triggers
  XBOXTrig = device.getSlider(4);
  leftTriggerTolerance = rightTriggerTolerance = XBOXTrig.getTolerance();
  leftTriggerMultiplier = rightTriggerMultiplier = XBOXTrig.getMultiplier();
  Rstick = device.getSlider(3);
  leftTriggerTolerance = rightTriggerTolerance = Rstick.getTolerance();
  leftTriggerMultiplier = rightTriggerMultiplier = Rstick.getMultiplier();
  // initiating the button objects
  Y = device.getButton(3);
  B = device.getButton(1);
  A = device.getButton(0);
  X = device.getButton(2);
  R1 = device.getButton(5);
  R3 = device.getButton(9);
  L1 = device.getButton(4);
  L3 = device.getButton(8);
  DPad = device.getCoolieHat(10);
  Select = device.getButton(6);
  Start = device.getButton(7);
  // initiate the Serial object to connect to the Arduino
  String portName = Serial.list()[0];// Change depending on which Serial Port your Arduino is connected to
  myPort = new Serial(this, portName, 57600);
  // Aesthetics
  fill(0); // makes the rectangle black
  rectMode(CENTER); // to ensure that the center of the rectangle represents the position of the stick

void draw() {
  background(200); // refresh
  // Analyse the input coming from the stick output
  // since the value is beween -1 and 1 scale it up to 128 and ensure it is an integer
  // by a cast. Since negative values are not accepted by servos, and there are 
  // serial communication issues, add 128 to the scaled value to get a 1 byte integer.
  int LposX = 91-int(Lstick.getX()*91);
  int LposY = 91+int(Lstick.getY()*91);
  int RposX = 91-int(Rstick.getValue()*91);
  int posZ = 91+int(XBOXTrig.getValue()*91);
  // ensure that the rectangle does not leave the bounds of the canvas
  // as well as making sure that the servos don't go out of bounds
  LposX = constrain(LposX, 1, 180);
  LposY = constrain(LposY, 1, 180);
  RposX = constrain(RposX, 1, 180);
  posZ = constrain(posZ, 1, 180);
 // send the signal if the stick indicates a turn to the left or right
  boolean turn = false; // to ensure that the stop signal is not sent if the car is supposed to turn
  try {
    // Turn Right
    if (LposX <= 90){
      turn = true;
    // Turn Left
    if (LposX >= 90){
      turn = true;
    // Move Forward
    if (LposY <= 90){
      turn = true;
    // Move Backward
    if (LposY >= 90){
      turn = true;
    // Camera Pan Left
    if (RposX >= 90){
      println("Pan Left");
      turn = true;
    // Camera Pan Right
    if (RposX <= 90){
      println("Pan Right");
      turn = true;
    }// Move Forward
    if (posZ <= 90){
      turn = true;
    // Move Backward
    if (posZ >= 90){
      turn = true;
  catch(Exception ex) {
    println("Exception has been reached");
  // check for the A button to be pressed
  // Move Backward (Brake)
  if (A.pressed()) {
    fill(0, 255, 0); // if pressed change the color of the rectangle to green
  // check for the B button to be pressed
  // Reset Camera Position
  if (B.pressed()){
    fill(255,0,0); // if pressed change the color of the rectangle to red
    println("Reset Camera");
  // check for the X button to be pressed
  // Reset Steering
  if (X.pressed()){
    fill(0,0,255); // if pressed change the color of the rectangle to blue
    println("Reset Steering");
  // check for the Y button to be pressed
  // Reset Throttle
  if (Y.pressed()){
    fill(255,255,0); // if pressed change the color of the rectangle to yellow
    println("Reset throttle");
  // Camera Pan Left
    if (L1.pressed()){
      println("Pan Left");
      turn = true;
    // Camera Pan Right
    if (R1.pressed()){
      println("Pan Right");
      turn = true;
    // check for the start button to be pressed
    // Reset Camera Position
    if (Start.pressed()){
    fill(255,0,0); // if pressed change the color of the rectangle to red
    println("Reset Camera");
  // check for the select button to be pressed
  // Reset Camera Position
  else if (Select.pressed()){
    fill(255,0,0); // if pressed change the color of the rectangle to red
    println("Reset All");
  // If no signal needs to be sent send the stop signal
  else if(!turn){
    fill(0); // otherwise let the rectangle be black
  // position the rectangles using the information on the position of the stick on the Xbox One Controller
  rect(LposX, LposY, 20, 20);
  rect(RposX, posZ, 20, 20);