The three basic gates: AND needs both inputs, OR settles for one, NOT flips; and how to choose a gate for what a circuit has to do.
Step 1 of 5 · AND
Step 1 of 5
AND
A logic gate is a small circuit that takes bits in and puts a bit out, by a fixed rule. A processor holds billions of them, each built from a few transistors. On the board two switches, A and B, feed traces to three gates, and each gate lights a lamp. A trace carrying a 1 glows, with beads of light flowing along it towards the output.
The first gate is AND: its output is 1 only if A is 1 and B is 1. Predict, and then A will go up.
Step 2 of 5
OR
The second gate is OR: its output is 1 if A is 1 or B is 1, and in logic “or” includes both. Now A is up and B is down, and the OR light is on.
Step 3 of 5
NOT
The third gate, NOT, is the simplest: it has one input, A, and flips it. 0 in, 1 out; 1 in, 0 out. In its symbol, the little circle at the tip marks the flip.
Step 4 of 5
Only AND
Now B is up and A is down. The OR light is on, but AND is not. Light it.
Step 5 of 5
Choosing a gate
Gates are how a computer makes decisions. “If there is a card and a code, open” is AND. “If the window or the door is open, ring” is OR. “If the keyboard has not been touched, turn off the screen” is NOT. Designing a circuit means turning a rule in words into gates.
Loading the interactive version…
Loading the interactive version…
Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.
Practice · Predict, then look
Both switches are down, and the AND and OR lights are dark. What will happen to the A AND B light when A goes up to 1 and B stays down?
Practice · Predict, then look
Both switches are down, and the AND and OR lights are dark. What will happen to the A AND B light when A goes up to 1 and B stays down?
Practice · Predict, then look
A is up and B is down, and the A OR B light is on. What will happen to it when B goes up as well?
Practice · Predict, then look
A is up and B is down, and the A OR B light is on. What will happen to it when B goes up as well?
Practice · Reach the target
The NOT A light is on. Change Input bits until it goes dark, and press Check.
Practice · Reach the target
The NOT A light is on. Change Input bits until it goes dark, and press Check.
Practice · Reach the target
Light the A AND B light, and press Check.
Practice · Reach the target
Light the A AND B light, and press Check.
Practice · Choose
An alarm should ring if the window opens, if the door opens, or if both do. Each sensor gives 1 when what it guards is open. Which gate joins the two sensors to the alarm?
Practice · Choose
An alarm should ring if the window opens, if the door opens, or if both do. Each sensor gives 1 when what it guards is open. Which gate joins the two sensors to the alarm?
Lesson complete. Every practice question here is done.