I want to control stepper motor with end switch using cnc shield.(not grbl)

I want to control stepper motor with end switch using cnc shield.(not grbl). can anyone help with codes?

mechanical-endstop-switch-ky-053-for-3d-printer-cnc-arduino-raspberry-pi.jpg

Look at the AccelStepper library examples.

These links may help.

Stepper Motor Basics
Simple Stepper Code

...R

thank you guys. i got it