OK, there is EDGE and LEVEL detection and for now, let's talk about LOGIC.
In a LOGIC system an INPUT is PULLED-UP to the LOGIC voltage and TYPICALLY a switch goes to ground.
So, suppose, you had 1K resistor connected to +5 and a switch to ground.
This now gives you two states, a logic 1 (when at +5) and a logic 0 when at 0 (the switch closed)
(This is simplified for now)
A RISING EDGE is the instant the voltage on the input changes from 0 to +5
A FALLING EDGE is the instant the voltage on the input changes from +5 to zero.
Now suppose, you were given a BLACK BOX that did the following:
On a RISING EDGE of it's input (Sx), a 1 second contact closure was provided for OUTPUT A
On a FALLING EDGE of it's input (Sx) , a 1 second contact closure was provided for OUTPUT B
A third output would be the state of switch Sx
A fourth output would be the inverted state of Sx
Let's suppose you were also given a black box, that told you:
MOTOR A is MOVING
MOTOR B is MOVING
(LOGIC combinations of the two inputs are optionally available too such as:
1. Neither motor is moving
2. One of the motors are moving
etc.
Now for the LIMITS, you might have to provide two of them. One for the motor and one for the LOGIC.
Things such as reflective object sensors or slot sensors, switches and hall effected switches are part of your arsenal.
What could you do with this?
See, how you could work with such a black box.
Although possible, the switch Sx could be a blip or be continuous from a slotted sensor. Only you can decide this. The LOGIC might be easier if it wasn't a BLIP.