Comparators can be made to perform a basic memory function by wiring them as a ‘SET / RESET’ type of FLIP/FLOP. This type of circuit can be used in unplugable walk around throttles to remember the direction of the train when the controller is disconnected. In the next diagram the comparator will remember which switch was pushed last. If the ‘SET’ button is pushed the LED will be on, the ‘RESET’ button will turn the LED off. A higher current version is also shown.
Read More Source: