I have a linier actuator with optical feedback and pwm control.
To extend and retract between two encoder points user definable in the code.
Homing on powerup required.
Single momentary button (use a counter for extend and retract?)
Upon extending the actuator will stop at a defined point with a timed delay, then continues to extend to the final encoder count stop point. When it gets close to the stopping point the actuator must slow for a soft stop.
Pressing the button a second time will retract the actuator to a final retracted encoder point, soft stopping as well.