So I have in mind the simple control of a dc motor (possibly a stepper instead) to spin one way or another at a constant speed by control of a simple button for each rotation direction. The purpose of the motor is to move a power screw (lead screw); think of an electric screwdriver that turns a threaded screw, that then linearly moves a connected object. So if I want to move an object perhaps an inch, I press the button until it is what looks like an inch.
Question: I need to be able to control how far the linear movement goes and stop at the limit (an equivalent problem of how many rotations of the screw I guess); so if movement reaches 5 inches, stop. I am assuming this involves what is know as closed-loop control. How do design it so that it doesn't go beyond a certain point? Is there a programming, sensor, or combination solution to this?