NPN Proximity sensor to find center??

I could really use some help and direction here. I'm very new to Arduino and programing.. So please .. I'm just looking for some direction.. Not have someone do it for me .. But if someone wants to do it for me .. I'm totally cool with that. JK. lol. Without knowledge we have no strength.

I have 3 npn prox sensors on a screw style tangent arm. 1 for left end stop. 1 for right end stop. And 1 for center.

So what I'm trying to accomplish is when I push button 1 the stepper motor drives the screw moving the arm until it finds center. If it hits the center prox sensor stop for 2 seconds then rest. If it hits the right prox center. Reverse direction and find center prox sensor and stop for 2 seconds then rest.

I know this is probably very simple. But I'm lost. Just to let you know this is for a very large telescope at a non profit observatory that's open to the public.

Thanks in advance

What if it's already centered? Have you written any code yet?

Here's some reading to prepare for questions from the forum and to get your feet on the ground with the Arduino/C++.

Start here and save yourself some time and grief later. ALL are valuable.
how to use this forum

before posting a programming question

pseudocode

several things at the same time

using millis() for timing

useful links

Sidetrips:

Arduino reference

Why switch debouncing is needed

Thank you.. :slight_smile:

Perhaps this- Scotty

And learn about state-machines... Identify the states and transitions in your motor-homing sequence.