Some years ago I designed and built
an auto-reverse controller that is commonly used to send a
trolley or other small engine back and forth on a point-to-point
line.
I recently revised the program and converted the code so that
it would work with a more contemporary microcontroller, the
Arduino.
My notes and a video that show the new controller are here: