Control a nema 17 stepper motor with proximity switch

Hi
I am trying to control a nema 17 bipolar stepper in linear direction motor usinng :-
1)Arduino UNO
2)TB6560 motor driver
3)Proximity switch (left and right switch)

Previously i tried it using 2 limit switches and it was going well but now i am facing difficulty with proximity switches (code and circuit)
So someone please provide me the complete code or algorithm with circuit (if possible) so that i can run the machine.

People are more likely to want to help you do your own project rather than doing the whole thing for you. If you want that, you will typically need to pay someone for their time. If you would rather have help doing the project yourself, post your best attempt at the code. Please use code tags (</> button on the toolbar).