I'm trying to learn more about electronics. So to do that I decided to implement boolean logic gates in a circuit simulator. So far I have made NOT, AND, NOR and a S-R latch.
I wanted to try connect them together to make a S-R latch with only one input - a momentary switch.
My idea was that if you press the switch, the output of the S-R latch just flips. To do this I figured that if I take the output of the latch and AND it with the input of the button, I could take this signal to either the S or R input of the latch. And then for the other input I would AND the NEGATION of the output of the latch with the button.
Here are the circuits I made:
And finally the full circuit:
What seems to happen is when the momentary switch is pressed, both inputs of the latch are being pulsed which causes it to never flip over to the other state.
What can I modify or add to this circuit to make it work correctly?