Simulate this circuit schematic created using circuitlab.
Motor limit switch circuit.
Not sure of polarities on diodes.
When the control switch is held in the right position the motor runs until the right limit switch opens.
Switch stops motor at limit and diode allows reversing of motor.
Since diode cr1 will not conduct with a negative potential across it the motor will stop.
Wiring diagram of a dpdt connected motor plus two snap action switches for user control with limit stops.
At this point it reverses the motor to open the door back up.
Endgroup enemy of the state machine aug 22 14 at 2 55.
Depending on you application knowing what relays are latched on startup may or may not be an issue for you.
The motor rotates one way closing the doors unless the limit safety switch is hit.
You have to figure up down and appropriate diode polarity.
The main function of the limit switch is to open or close an electric circuit when the physical limit of the operation of the controlled device has reached.
The limit switch means comprises a pair of mechanicaly interlocked molded case circuit breakers with each of the circuit.
Insert this into either black or white wire going to the motor.
It may be operated by a by a cam or lever fitted with the machine to stop reverse or slow down the operation of the device used for a particular application.
A motor operating device for reciprocating a circuit breaker handle structure between operating positions comprises a reversible motor an opening relay a closing relay and limit switch means operable to interrupt the motor circuit and to deenergize the energized relay.
But for an automotive relay a relay my reference pin 30 3 pin 85 7 pin 86 8 pin 87 5 pin 87a 1 the limit switches should be wired normally closed so that when the load reaches them it opens the switch.
It would be nice to add a couple of additional switches to automatically stop the motor when it has gone too far but still allow the operator to return the motor to an allowed position.