Just for some context, I've hooked up the NO of my limit switch to the Y+ Endstop on the CNC Shield and the COM to the GND (which i'm assuming is the one next to the Y+). I've done the same with my 2nd limit switch but with the NO connected to Y- Endstop.
According to this diagram, the Y limit axis is pin 10 which is why I've defined it to be 10 in my code.
Is there a better way to achieve the same "ping pong" movement using a different library? I've tried writing my own code with the stepper.h library but that also didn't turn out that great in the end. However I somehow got the limit switches to semi-work.
Since your code depends on interrupts, you need to use a pin that supports interrupts:
...says pins 2 or 3 have interrupts on the Uno, and since you are already using 3 for "step pulse y" you can only use pin 3. So figure out how to hook the limit switches to pin3/StepPulseX instead of pin 10.
Alternately, don't use interrupts, keep your same connections and try adapting something like the Files/Examples/Digital/StateChangeDetection to read pin 10, and once that work, blend those bits in with your sketch.
So I've made some minor changes and now the stepper motor does run. However the direction of the stepper motor changes only when the limit switch is pressed down, I'd like it to change direction after being pressed once if that makes sense.