Redstone latches and flip-flops act as a way to store inputs (data), which can then be given on a different moment. This is useful when you want to make an input do different things each time it’s pushed.For example, a button attached to a T-flip-flop will essentially turn that button into a lever, as pushing it once will turn on whatever is connected to the flip-flop until the button is pushed again.
A T flip-flop is a great mechanism which basically acts as a toggleable output, which means pulse generating blocks, like buttons and pressure plates, can be turned into toggles, like a lever. The T flip-flop will take an input, change itself and that change will either block or release a signal to an output.
Note that in the picture below, there’s a redstone torch below the stone block pushed by the pistons, which is activating the redstone to the right.
A D flip-flop is a way to store an input (data), but only when you toggle the save mechanism. The D flip-flop (in our example) has 2 inputs, one is the actual input (right lever) and the other is our save mechanism (left lever). When you pull the right lever, the piston will be activated, but when you pull the lever again, the piston will be deactivated. The save mechanism allows us to store the input, whether it’s on or off, which means pulling the input lever has no effect on the piston.
So if, for example, we first pull the right lever and we then save that input (on), by pulling the left lever, the save mechanism will store the input and makes sure the pistons stays activated, even if we turn off our right lever. The reverse is also true, if we first pull the left lever, the save mechanism will store the off-state signal and we won’t be able to activate the piston when we pull the right lever.
RS NOR latch
An RS NOR latch will turn something on or off forever, until another signal is received from a different input, which will do the opposite. In the picture below, pushing the right button will activate the piston. The piston will not deactivate, until the left button is pushed. So pushing the right button twice will not affec the piston after it has been activated.
RS NAND latch
An RS NAND latch is exactly the same as an RS NOR latch, but instead of using NOR gates, you use NAND gates. The RS NAND gate is therefore less compact and not really used too often.
However, there’s 1 difference between RS NAND and RS NOR latches, which is that the outputs are inverted. This could be useful, but it’s a lot easier to simply attach a NOT gate to the output of an RS NOR latch to invert that output.