Stepper moving when not supposed to

Hey everyone, I've got 2 stepper motors hooked up to run off one joystick (one stepper on X and the other on Y).

One of the controllers is dead so can't test with both steppers but regardless the issue is with the one. The X stepper should only move when the X axis of the joystick is being used, but currently it moves when either the X or Y of the joystick are actuated. Is there anything wrong with my code that could be causing this?

Ignore the variables for the button. That's for later if I can get this to function properly.

On the serial monitor it works perfectly, all outputs match what I'm doing with the joystick.

#include <Stepper.h>
Stepper stepper1(4096, 2, 3, 4, 5);
Stepper stepper2(4096, 8, 9, 10, 11);

const int servo1In1Pin = 2;
const int servo1In2Pin = 3;
const int servo1In3Pin = 4;
const int servo1In4Pin = 5;

const int servo2In1Pin = 8;
const int servo2In2Pin = 9;
const int servo2In3Pin = 10;
const int servo2In4Pin = 11;

const int vrXPin = A0;
const int vrYPin = A1;
const int joyButtonPin = 13;

int vrX = 0;
int vrY = 0;

boolean buttonPressed = false;

void setup() {
  pinMode(servo1In1Pin, OUTPUT);
  pinMode(servo1In2Pin, OUTPUT);
  pinMode(servo1In3Pin, OUTPUT);
  pinMode(servo1In4Pin, OUTPUT);

  pinMode(servo2In1Pin, OUTPUT);
  pinMode(servo2In2Pin, OUTPUT);
  pinMode(servo2In3Pin, OUTPUT);
  pinMode(servo2In4Pin, OUTPUT);

  pinMode(joyButtonPin, INPUT_PULLUP);
  Serial.begin(9600);

}

void stepper1Write(int a1, int b1, int c1, int d1) {
  digitalWrite(servo1In1Pin, a1);
  digitalWrite(servo1In2Pin, b1);
  digitalWrite(servo1In3Pin, c1);
  digitalWrite(servo1In4Pin, d1);
}

void stepper2Write(int a2, int b2, int c2, int d2) {
  digitalWrite(servo1In1Pin, a2);
  digitalWrite(servo1In2Pin, b2);
  digitalWrite(servo1In3Pin, c2);
  digitalWrite(servo1In4Pin, d2);
}

void step1Forward() {
  stepper1Write(1, 1, 0, 0);
  delay(5);
  stepper1Write(0, 1, 1, 0);
  delay(5);
  stepper1Write(0, 0, 1, 1);
  delay(5);
  stepper1Write(1, 0, 0, 1);
  delay(5);
}

void step1Reverse() {
  stepper1Write(1, 0, 0, 1);
  delay(5);
  stepper1Write(0, 0, 1, 1);
  delay(5);
  stepper1Write(0, 1, 1, 0);
  delay(5);
  stepper1Write(1, 1, 0, 0);
  delay(5);
}

void step1Stop() {
  stepper1Write(0, 0, 0, 0);
  delay(5);
  stepper1Write(0, 0, 0, 0);
  delay(5);
  stepper1Write(0, 0, 0, 0);
  delay(5);
  stepper1Write(0, 0, 0, 0);
  delay(5);
}

void step2Forward() {
  stepper2Write(1, 1, 0, 0);
  delay(5);
  stepper2Write(0, 1, 1, 0);
  delay(5);
  stepper2Write(0, 0, 1, 1);
  delay(5);
  stepper2Write(1, 0, 0, 1);
  delay(5);
}

void step2Reverse() {
  stepper2Write(1, 0, 0, 1);
  delay(5);
  stepper2Write(0, 0, 1, 1);
  delay(5);
  stepper2Write(0, 1, 1, 0);
  delay(5);
  stepper2Write(1, 1, 0, 0);
  delay(5);
}

void step2Stop() {
  stepper2Write(0, 0, 0, 0);
  delay(5);
  stepper2Write(0, 0, 0, 0);
  delay(5);
  stepper2Write(0, 0, 0, 0);
  delay(5);
  stepper2Write(0, 0, 0, 0);
  delay(5);
}
void loop() {
  vrX = analogRead(vrXPin);
  vrY = analogRead(vrYPin);
  
  Serial.println(vrX);
  if (vrX < 400) {
    step1Reverse();
    Serial.println(" 1 Reverse");
  }
  else if (vrX > 750) {
    step1Forward();
    Serial.println(" 1 Forward");
  }
  else if (vrX > 400 && vrX < 750) {
    step1Stop();
    Serial.println(" 1 Stop");
  }
  
  Serial.println(vrY);
  if (vrY < 400) {
    step2Reverse();
    Serial.println(" 2 Reverse");
  }
  else if (vrY > 750) {
    step2Forward();
    Serial.println(" 2 Forward");
  }
  else if (vrY > 400 && vrY < 750) {
    step2Stop();
    Serial.println(" 2 Stop");
  }
}`
 1 Stop
509
 2 Stop
532
 1 Stop
508
 2 Stop
706
 1 Stop
510
 2 Stop
1012
 1 Forward
509
 2 Stop
1011
 1 Forward
506
 2 Stop
1011
 1 Forward
507
 2 Stop
1010
 1 Forward
509
 2 Stop
1010
 1 Forward
506
 2 Stop
1012
 1 Forward
507
 2 Stop
1014
 1 Forward
509
 2 Stop
1011
 1 Forward
508
 2 Stop
1010
 1 Forward
508
 2 Stop
1012
 1 Forward
508
 2 Stop
1013
 1 Forward
509
 2 Stop
1011
 1 Forward
509
 2 Stop
1012
 1 Forward
510
 2 Stop
1013
 1 Forward
507
 2 Stop
1011
 1 Forward
509
 2 Stop
1015
 1 Forward
509
 2 Stop
1012
 1 Forward
510
 2 Stop
1015
 1 Forward
511
 2 Stop
1012
 1 Forward
509
 2 Stop
1014
 1 Forward
509
 2 Stop
1015
 1 Forward
512
 2 Stop
1017
 1 Forward
511
 2 Stop
1014
 1 Forward
509
 2 Stop
1011
 1 Forward
508
 2 Stop
705
 1 Stop
510
 2 Stop
502
 1 Stop
506
 2 Stop
504
 1 Stop
506
 2 Stop
501
 1 Stop
508
 2 Stop
500
 1 Stop
507
 2 Stop
506
 1 Stop
506
 2 Stop
171
 1 Reverse
505
 2 Stop
0
 1 Reverse
506
 2 Stop
0
 1 Reverse
505
 2 Stop
0
 1 Reverse
508
 2 Stop
0
 1 Reverse
506
 2 Stop
1
 1 Reverse
504
 2 Stop
1
 1 Reverse
506
 2 Stop
1
 1 Reverse
509
 2 Stop
6
 1 Reverse
506
 2 Stop
0
 1 Reverse
508
 2 Stop
0
 1 Reverse
506
 2 Stop
1
 1 Reverse
507
 2 Stop
0
 1 Reverse
509
 2 Stop
0
 1 Reverse
506
 2 Stop
0
 1 Reverse
503
 2 Stop
3
 1 Reverse
499
 2 Stop
0
 1 Reverse
507
 2 Stop
0
 1 Reverse
506
 2 Stop
0
 1 Reverse
504
 2 Stop
0
 1 Reverse
505
 2 Stop
0
 1 Reverse
504
 2 Stop
0
 1 Reverse
505
 2 Stop
0
 1 Reverse
505
 2 Stop
0
 1 Reverse
508
 2 Stop
0
 1 Reverse
507
 2 Stop
502
 1 Stop
508
 2 Stop
503
 1 Stop
510
 2 Stop
505
 1 Stop
508
 2 Stop
505
 1 Stop
510
 2 Stop
504
 1 Stop
510
 2 Stop
504
 1 Stop
509
 2 Stop
504
 1 Stop
512
 2 Stop
506
 1 Stop
511
 2 Stop
506
 1 Stop
511
 2 Stop
507
 1 Stop
1017
 2 Forward
612
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
612
 1 Stop
1023
 2 Forward
612
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
612
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
613
 1 Stop
1023
 2 Forward
611
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
610
 1 Stop
1023
 2 Forward
611
 1 Stop
615
 2 Stop

What do all your serial prints tell you?

Seems to be executing perfectly on the serial monitor.

Why not call them xStepper and yStepper?

Please remember to use code tags when posting code

I'm pretty fresh to code, only started the other day, got gifted a bunch of arduino stuff.

First post on the forum, how do I use code tags?

You read this, right?

Cheers, fixed the tags.

Any idea why the issue might be happening?

It would help if you could post your serial output.

Posted, That's running through both X and Y on the joystick.

I think I've just spotted it, in the stepper2Write function I have the wrong variable in the digitalWrite().

The dangers of cut-and-paste programming

Glad I've learned that one early on.