Computer ScienceComputingHigh schoolKey Stages 4 and 5
How to teach logic gates
Logic gates turn inputs of 1 and 0 into one output, and AND, OR and NOT are the three students learn first. This page explains each gate and its truth table, with a free activity where students wire an alarm circuit to a spec.
Jemel Fanfan | Founding Member at Flint

"With any other activity, top students want to move to more complex material, and others need more time on basics. In Flint's activities, I can rotate as a facilitator and Flint automatically scales the assignments to each student's skill level."
Jake Kazlow, Computer science teacher at WestminsterWhy this matters
A spec written in English says "the door is open and the system is armed", and many students wire an OR gate because both things sound like reasons for the alarm. Their truth table comes back with two wrong rows and no clue which word misled them. The student who wired it right sits with nothing harder to try, and the teacher has to wait for quiz day to find out who still reads "and" as OR.
What students need to know about logic gates
A logic gate is a circuit part that takes inputs of 1 (true) or 0 (false) and gives one output (BBC Bitesize).
- An AND gate outputs 1 only when both inputs are 1.
- An OR gate outputs 1 when either input is 1, or both are.
- A NOT gate has one input and flips it: 1 becomes 0 and 0 becomes 1.
A truth table lists the output for every combination of inputs, so a circuit with three switches has 8 rows. Boolean algebra writes the same circuit as an expression, such as (Door AND Armed) OR Panic. Python has the same Boolean logic operators, so the alarm is one line of Python (Python documentation):
alarm = (door and armed) or panic
In the Flint activity, each student wires an alarm circuit to a client's spec in a circuit builder Sparky made, then types its 8-row truth table. A worksheet only marks a wrong table wrong, while Sparky names the first row where the student's alarm misbehaves and asks what the spec says for it.
Sparky gets Kai to catch his own OR-for-AND mistake
Kai ends up able to explain why the spec's "and" needs an AND gate, after one row of his own truth table shows him the bug. Everyone in the class gets the same alarm activity, and Sparky's replies depend on the circuit and truth table each student types.
Kai
Sparky

Kai
i used 2 OR gates: door OR armed, then that goes into another OR with panic, then the alarm
Sparky
Kai
i read "and" like a list, like door and armed are both things that set it off. so i swapped the first gate to AND.
Sparky
Fixed his OR-for-AND mistake from one row, then got a harder spec
Kai is an example student, and his and Sparky's messages are shortened.
What Flint did for Kai
- Sparky attached a circuit builder to the greeting, so Kai wired and tested his alarm before writing a truth table.
- When Kai's alarm sounded with the door closed, Sparky named row 0 1 0 instead of naming the gate.
- Once Kai swapped in an AND gate and his table matched, Sparky gave him a harder Pet mode spec.
A teacher can't do this by hand for 30 students, and Sparky does it in every student's chat.
The activity page shows who still reads "and" as OR
While the class works, Needs attention shows the teacher which student is stuck and on which message. After three or more students submit, activity analytics lists what the class did well, where students went wrong, and a follow-up to practice next.

Example activity page
After a computer science class wires the alarm
The school and students are made up for this page, and clicking any student opens their chat.
Set up the activity for free
The alarm activity is in Flint's public library, with the circuit builder, Sparky's guidelines and the greeting already written. Open it, select Use activity to copy it into a free Flint account, and assign it to a class. Sparky builds the four-switch circuit builder for the Pet mode spec inside each student's chat, once that student's first table is right.
For more computer science activities, see Flint for computer science.
Other use cases
See all use cases →MathematicsMathsMiddle schoolKey Stage 3

How to teach math to English language learners
ELL math strategies for multilingual learners: give the key terms in each student's home language, teach the words before the problems, and match each question to the student's level, shown with a free linear equations review.
Social StudiesHumanitiesElementaryPrimary

How to teach Native American regions
Teach Native American regions through the homes each nation built. Students move four homes between four regions, a student who says a nation built its home because they liked it gets sent back to a region card, and a right answer gets a harder question.
World LanguageModern foreign languagesElementaryPrimary

How to teach numbers in Spanish
How to teach numbers in Spanish, from the single-word names for 0 to 29 to the tens joined with y. In a free Flint activity, Sparky builds each student a market stand with price tags, sends a student who mixes up quince and cincuenta back to the tag, and gives a harder price after a right answer.
