How to wire up a latching circuit