Issues using PING, PIR, and ULN2003 stepper driver together.

In my project I am using 2 PIR mini sensors to detect movement from either left or right and have the stepper motor move in the corresponding direction until the Arduino receives a signal from a PING sensor or a signal from one of two limit switches telling the stepper motor to stop.

Here is the hardware I am using in my project:
-Arduino UNO r.3
-2 Parallax PIR mini #28033 sensors
-Parallax PING sensor
-28BYJ-46 5V stepper motor
-ULN2003 driver
-UNO board is powering the 3 sensors, separate power supply is used for stepper motor and driver.

My Issue:
I had the sketch moving the stepper motor left and right with the PIR sensors and stopping with the limit switches just like I wanted, but as soon as I combine the PING sensor and code to the project, it no longer works at all. The only thing that happens when I upload the code to the UNO is the “A” LED light comes on, but nothing else functions.

I am using the CustomStepper.h library, and my first (of many attempts) to solve this problem I was using no library for the PING sensors just the basic example code. I wondered if it had something to do with the pulseIn part of the code so I tried it with the “NewPing.h” library because I read that this library did not use the pulseIn funtion. Same result, so I went back to my original code.

Any assistance or suggestions as to why this will not work when I combine the two sketches together would be awesome! Thank you.

Here is my code now that does not work.

#include <CustomStepper.h>

//Full constructor, just the first 4 parameters are necessary, they are the pins connected to the motor,
//the others are optional, and default to the following below
//the 5th paramater is the steps sequence, where the 1st element of the array is the number of steps
//it can have a maximum of 8 steps
//the 6th parameter is the SPR (Steps Per Rotation)
//the 7th parameter is the RPM
//the 8th parameter is the rotation orientation
CustomStepper stepper(2, 3, 4, 5, (byte[]) {
  8, B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001
}, 4075.7728395, 12, CW);

const int pingPin = A0;
unsigned int duration, inches;

const int rightPirPin = 9;
const int leftPirPin = 8;
const int rtSafePin = 13;
const int ltSafePin = 12;
boolean rtPirState = false;
boolean ltPirState = false;
boolean rtSafeState = false;
boolean ltSafeState = false;
int pingState = false;

void setup()
  //sets the RPM
  stepper.setRPM(3);     //was initially at 12
  //sets the Steps Per Rotation, in this case it is 64 * the 283712/4455 annoying ger ratio
  //for my motor (it works with float to be able to deal with these non-integer gear ratios)
  pinMode(rightPirPin, INPUT);
  pinMode(leftPirPin, INPUT);


void loop()
  pinMode(pingPin, OUTPUT);                         // Set pin to OUTPUT
  digitalWrite(pingPin, LOW);                       // Ensure pin is low
  digitalWrite(pingPin, HIGH);                      // Start ranging
  delayMicroseconds(5);                             //   with 5 microsecond burst
  digitalWrite(pingPin, LOW);                       // End ranging
  pinMode(pingPin, INPUT);                          // Set pin to INPUT
  duration = pulseIn(pingPin, HIGH);                // Read echo pulse
  inches = duration / 74 / 2 / 12;                  // Convert to inches(feet)

  rtPirState = digitalRead(rightPirPin);
  ltPirState = digitalRead(leftPirPin);
  rtSafeState = digitalRead(rtSafePin);
  ltSafeState = digitalRead(ltSafePin);

if (stepper.isDone() && inches > 0 && inches < 8)
if (rtSafeState == false && ltSafeState == false)  //if either limit switch is on it stops all
    if (stepper.isDone() && rtPirState == true)

      stepper.setDirection(CW);                      //stepper move clockwise
      stepper.rotateDegrees(1);                      //step one degree at a time. allows for faster reaction
                                                     //instead of going 10-20 degrees and then stop.
    if (stepper.isDone() && ltPirState == true)
      stepper.rotateDegrees(1);                      //step one degree at a time. allows for faster reaction
    }                                                //instead of going 10-20 degrees and then stop.

  if (rtSafeState == true)                           //if limit swith is true stepper will stop. I put the
  {                                                  //next line to handle the fact that when the limits
    if (stepper.isDone() && ltPirState == true)      //are true, no matter what signal is given the
    {                                                //stepper will never move. These lines of code
      stepper.setDirection(CCW);                     //overcome that.


  else if (ltSafeState == true)
    if (stepper.isDone() && rtPirState == true)
  };                                    //auther of library says this is critical, and is right
}                                                   //must have this command in loop or nothing will work