The gated D latch is perhaps the fundamental 1-bit memory unit in active digital logic.
There are a few ways of constructing a D latch, here I’m using a NAND gate SR latch as the base, which is convenient as all it requires is a single 74LS00 (quad two-input NAND).
As always, all notes, schematics and code are in the Little Electronics & Arduino Projects repo on GitHub