Help with robot arm

Hi all, im just looking for a little guidance. I have 3d printed a 4 degree of freedom robot arm with 4 servo motors that I am currently trying to program.

my problem is that I only have one joystick, and the current code I am using is only for controlling 2 servo motors, Im wondering how I can adapt this code to click the joystick button and it switch control to servo motors 3&4(joyX2 and joyY2) instead of 1&2.(joyX1 and joyY1)

If someone could point me in the right direction to a video or has a quick minute to explain that would be absolutely amazing.

Here is the code;

#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

int joyX1 = A0;
int joyY1 = A1;

int joyX2 = A0;
int joyY2 = A1;

int servoVal;

void setup() {

servo1.attach(6);
servo2.attach(9);
servo3.attach(10);
servo4.attach(11);
}

void loop() {

servoVal = analogRead(joyX1) ;
servoVal = map(servoVal, 0, 1023, 0, 180);
servo1.write(servoVal); servoVal = analogRead(joyX1);

servoVal = analogRead(joyY1);
servoVal = map(servoVal, 0, 1023, 0, 180);
servo1.write(servoVal); servoVal = analogRead(joyY1);

servoVal = analogRead(joyX2) ;
servoVal = map(servoVal, 0, 1023, 0, 180);
servo1.write(servoVal); servoVal = analogRead(joyX2);

servoVal = analogRead(joyY2);
servoVal = map(servoVal, 0, 1023, 0, 180);
servo1.write(servoVal); servoVal = analogRead(joyY2);

You should read the values from the two axes and save them in variables.

Then you should have a button that when pressed toggles a variable between two values - for example servoGroup = 'A' or servoGroup = 'B'

Then you can have some code that applies the axes values to the appropriate servos - something like this

if (servoGroup == 'A') {
   servo1.write(xAxisVal);    
   servo2.write(yAxisVal); 
}
if (servoGroup == 'B') {
   servo3.write(xAxisVal);    
   servo4.write(yAxisVal); 
}

...R

"my problem is that I only have one joystick, and the current code I am using is only for controlling 2 servo motors, Im wondering how I can adapt this code to click the joystick button and it switch control to servo motors 3&4(joyX2 and joyY2) instead of 1&2.(joyX1 and joyY1)"

You might run into the problem that when you position two servos and then release the button on the joystick, the other servos will immediately do something based on that joystick position. When you use one pot to control two different things, things can get complex.

thanks so much for your help guys, maybe ill just order another joystick from amazon, tried to rip apart an old xbox one controller but me being the rookie I am didnt realize itd be soldered into the board, and I dont have a heat gun.

I really appreciate the help and advice.

You can get the inexpensive joystick modules like below and maybe save some time and $$$.