Digital computers work on the fundamental principle of Boolean logic. The inputs to and the outputs from Boolean logic are True and False or Logic 1 and Logic 0 respectively. The fundamental building blocks in Boolean logic are AND, OR and NOT. Circuits composed of transistor switches can be arranged to implement these Boolean functions.
The first two input Boolean logic gate called an AND is simple enough: if both of the inputs, A and B, are logic 1 then the output, Y, is a logic 1. If either input A or input B is a Logic 0 then the output, Y, is a Logic 0. The symbol for an AND along with a table of inputs and the output are shown.
The next fundamental two input Boolean logic gate is called an OR. If both of the inputs are logic 0 then the output is a logic 0. However, if either of the inputs is a Logic 1 then the output, Y, is a Logic 1. The symbol for an OR along with a table of inputs and the output are shown.
The last fundamental logic gate is a NOT (also called an inverter). It has one input, A, and one output, Y. The NOT functions as an inverter: if the input A is a Logic 1 then the output, Y, is a Logic 0. But if the A input is a Logic 0 then the output, Y, is a Logic 1.
The fundamental Logic gates can be combined to represent other Boolean logic values. For example, if a NOT or inverter is places after an OR then the output of the inverter will be what is known as a NOR. The Logic Table is shown.
Similarly, if a NOT or inverter is placed after an AND then the output of the inverter will be what is known as a NAND. The Logic Table is shown
By using a digital gate, a more complex structure can be created: the Flip-Flop. A Flip-Flop is essentially a memory cell that remembers a single bit. We will discuss a special kind of Flip-Flop: the āDā Flip-Flop . The D-Flip-Flop has four inputs and two outputs. One input is the D input. You place a Logic 0 or a Logic 1 at the D input. Another input is the clock. If the clock goes from being at Logic 0 to Logic 1 then the D input is passed to an output. The main output is called Q and after a clock input low to high transition whatever logic level that was on D is transferred to Q. Another output is -Q or the inverted Q output. If Q is outputting a Logic 1 then -Q is output a Logic 0. The opposite is also true.
Two additional inputs to the D Flip-Flop are the Set and Reset inputs. If the Set input is a Logic 0, then the output Q becomes a Logic 1 and it stays there even as the Set input goes back to a Logic 1. The Reset input is similar except that, if it too is driven low then the Q output becomes a Logic 1 and it stays there until something else happens.
In order to create and control a Logic 1 in this puzzle, TinkerCAD gives us a slide switch. One side of the switch is connected to the 5V signal from an Arduino microcontroller through a resistor (to limit the current). The other side of the switch is connected to ground or Logic 0. This means that we can use the center terminal of the slide switch to control the inputs to logic. When the switch is in the left position (left image), the logic will see a Logic 1 and in the right position (right image) a Logic 0.
The white breadboards used in the logic puzzle circuit work as their physical counterparts. Edge pins that have a black stripe are all common to each other. That means, any wires plugged into them are also connected to each other. The same goes for the edge pins adjacent to the red stripe. Typically, the black strip is connected to ground and the red to positive voltage. In our case that is 5 volts because the Arduino we are using is also 5V.
For the rest of the pins on the board, there are 5 pins on either side of the center line of the board. Anything plugged into those pins is common to each other i.e. connected to each other electrically. In the image below, an example of common pins is circled.