Understanding Gates – NOT Gate
Lab: Basics of Data and Program Circuitry
Video Runtime: 10:10
The NOT gate in both circuitry and software represent an inverse or opposite state. It’s an inverter, meaning it flips the state and returns the opposite of it.
Your key takeaways for this episode are:
- NOT works the same in circuitry as it does in code
- The NOT gate (or the
!
in your code) gives you the opposite-or inverse-state
Study Notes
NOT = Inverse (Opposite state)
What is the opposite state of the following?:
- On (off)
- Ok (not ok)
- True (false)
- 1 (0)
- Go (stop)
Inverse Relay Logic
In inverse relay logic, when the relay is off, the natural state is connected. It is connected because it has a full circuit from the source to the ground.
Truth Tables
Switch (input) | Light bulb (output) |
---|---|
Off | On |
On | Off |
NOT Gate
Let’s check out this piece of code for example:
<?php | |
if (! is_page() ) { | |
showTopbar(); | |
} |
So, if the state is true, that is, if it’s NOT a page, then the
showTopbar()
function will run.
is_page() |
showTopbar() |
---|---|
False (off) | Fires (on) |
True (on) | Does not fire (off) |
External Reference Articles
Break. Go rest your noodle for a couple of minutes.
Episodes
Total Lab Runtime: 01:53:22
- 1 Lab Introductionfree 02:20
- 2 Understanding Switch Logicfree 13:36
- 3 Introduction to Pseudocode and Truth Tablesfree 16:28
- 4 Understanding Gates – NOT Gatefree 10:10
- 5 Understanding Gates – AND Gatefree 15:07
- 6 Understanding Gates - OR Gatefree 10:33
- 7 Understanding Gates – XOR Gatefree 10:42
- 8 Understanding Gates – NAND Gatefree 07:10
- 9 Understanding Gates – NOR Gatefree 06:34
- 10 Basics of Memory Circuit – S-R Latchfree 04:41
- 11 Basics of the Adder Circuitfree 16:01