See the attached diagram for wiring up a DC motor to a relay that reverses the motor's direction. It also includes limit switches that turn off the motor once whatever it's moving reaches a certain position. I used this with a linear actuator that opened and closed a coffin lid. I simply triggered the relay to open the lid, which then stops when the 'open' limit switch is reached. To close the lid I simply untriggered the relay at the appropriate time, which runs the DC motor the other way until the 'close' limit switch is reached. Easy peasy.
Found it amongst my old construction documents and though it might be useful to someone.
Found it amongst my old construction documents and though it might be useful to someone.