2nd stepper motor not reversing direction

I’m setting up 2 stepper motors to trigger on switches, going one direction on one button press, and the opposite direction on the other button’s press. Right now everything in my code works as I want it: locking out of being able to go the opposite direction until the other button is pressed. However, the 2nd motor as of now is not working correctly, on either button press the 2nd motor will continue in the same direction, instead of turning the opposite direction, like the 1st motor properly functions. I don’t understand how my code could be wrong, it’s basically a mirror of the first motor.

#include <Stepper.h>

#define motorSteps 48 // change this depending on the number of steps
// per revolution of your motor
#define motorPin1 8
#define motorPin2 9
#define motorPin3 10
#define motorPin4 11
#define motorPin5 4
#define motorPin6 5
#define motorPin7 6
#define motorPin8 7

// initialize of the Stepper library:
Stepper myStepper(motorSteps, motorPin1,motorPin2,motorPin3,motorPin4);
Stepper myStepper2(motorSteps, motorPin8, motorPin5, motorPin6, motorPin7);
const int buttonPin2 = 2;
const int buttonPin3 = 3;
int buttonState1 = 0;
int buttonState2 = 0;
int Start = 0;
int End = 0;

void setup()
// set the motor speed at 60 RPMS:

pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);

// Initialize the Serial port:

void loop()

buttonState1 = digitalRead(buttonPin2);
buttonState2 = digitalRead(buttonPin3);

if (buttonState1 == HIGH)
while (Start == 0)
// Step forward 100 steps:
//int End;
End = 0;

if (buttonState2 == HIGH)
while (End == 0)
// Step backward 100 steps:
//int Start;
Start = 0;


Why are you using the pin order " motorPin8, motorPin5, motorPin6, motorPin7" instead of "motorPin5, motorPin6, motorPin7, motorPin8"?

How are the motors connected?

I just typo'd when I was putting them in, didn't think that order had any affect on the outcome. The motors are connected through a 2803? darlington chip, one of them on pins 4,5,6,7, and the other on pins 8,9,10,11. I don't have the circuit in front of me right now, it's sitting at our school with the rest of our project at the moment.

Changing the order of the numbers did matter apparently, when I did it, it completely fixed my problem. Thank you very much for the help!