Controlling stepper motor with potentiometer

Hello community.

The idea is to control one motor to move an object along a track at a speed determined by a potentiometer. Additionally i want to have two buttons and two limit switches, such that;

Button 1: Start/Stop
Button 2: Reverse direction every time its pressed

Limit switch: When the switch is hit, it reverses the direction of travel.

Any ideas on what approach I should take to the code?

Thanks, Till.

(PS using a Nema-17 59Ncm motor, and I haven't decided on the stepper controller yet).

These links may help

Stepper Motor Basics
Simple Stepper Code

Several Things at a Time

Us the potentiometer to vary the value in the variable that determines the interval between steps.


Any ideas on what approach I should take to the code?

Take a step-by-step approach.

What part(s) seem even remotely difficult?

For the limit switch(es), think about how you move around an unfamiliar room at midnight during a power outage. Very small steps, right? So you don’t try to kick the couch across the room.

Each time the stepper steps, check the limit switch.