I'm using 2 ultrasonic sensors to reverse the direction of a ram using a couple of relays to reverse the polarity.
Basically when the head of the ram comes within range of one sensor it switches the polarity and should travel back until it's within range of the second sensor.
However as far as I can see, as soon as the ram moves outside the range of the first sensor its distance resets and the ram then moves back and forth to just inside and outside the range of the sensor.
Is there a way to program the first output to latch and reset when the second sensor is triggered? Or would I have to build an external latching circuit to achieve this?