Posted on

20/09/13 – Lesson 5 Basic Logic Gates

Logic Gates are around us in everything. They can be used metaphorically to explain choices we make, or we can see them in circuits in gadgets around the house. You also have to use logic to make decisions in large groups of code. There are 3 basic logic gates:

AND Gate

And

This gate requires all inputs to be 1, for an output of 1, or else you will get an output of 0. You will only get a fully flowing circuit if all the values are high. This is useful if you need 2 conditions for one thing to happen, like in a car park, for example if the car has to be in the right position and the car park has to have spaces in it for a ticket to come out.

NOT Gate

Not

For this gate if the input is 0 then the output is 1. And if the input is 1 then the output must be 0. As this gate produced a value which is the opposite of what it should be, it gives us NOT values. These are often used in the cases of push-to-break switches, ifthe switch is pushes (1) then the output will be nothing (0), and vice versa. We see this in the case of emergency stop buttons

OR Gate

OR

The OR gate require one or the other input to be 1 for an output of 1. So if one of the other are on you will get the circuit one. An OR gate also works if both values are 1. This can be useful if you have 2 switches controlling one light, in which case if one or the other are on then the circuit should work.

Leave a comment