## Introduction

### Introduction Video

### Truth Tables

When we are working out what possibilities exist for a particular Boolean logic structure, we can use a truth table to represent that data.

Using the previous example we can produce a simple truth table for the results.

Input |
Output |

1 |
1 |

0 |
0 |

## AND

**AND Gates**

A Boolean AND gate works by the following rules:

- If both inputs are true, then the output will be True.
- Otherwise the output will be false

**Scratch Example**

**Challenge 1 – AND Gate truth table**

Can you fill out the truth table for an AND gate?

## OR

**OR Gates**

A Boolean OR gate works by the following logic:

- If either input is True, the output is True.
- If both inputs are True, the output is True.
- Otherwise the output is false.

**Scratch Example**

**Challenge 2 – Can you work out the truth table for a Boolean OR gate?**

## NOT

### NOT Gate

A Boolean NOT gate simply reverses whatever input is given.

- If the input is True, the output is False
- If the input is False, the output is True

**Scratch Not gate Example**

**Challenge 3 – Can you write a truth table for a NOT gate?**

## Practice

## Activity 1

Have a go at connecting up multiple logic gates to see what happens, using the simulator below. Can you work out the inputs and outputs for the following examples.

https://academo.org/demos/logic-gate-simulator/

**Example 1**

**Example 2**

**Example 3**

**Example 4**

## Activity 2

**Activity 2 – Applying Logic Gates**

Using the link below, see if you can make the following systems:

Logic Gates Application Simulator

**System 1 – Fan cooling system.**

If the main system switch is turned on, then the fan will operate when:

- Every 5 seconds
- When The manual override button is pressed.

**System 2 – Basic Alarm System**

Make a system where if any of the 3 sensors (use 3 switches to represent sensors) are triggered, the alarm light will flash RED.

**System 3 – Advanced Alarm System**

Adapt the system so that:

- The alarm will not be triggered if the system has not been armed first (use another switch for this)
- The alarm should alternate between flashing red and sound a siren every 1 second.

**System 4 – Button operated traffic light.**

Make a traffic light that starts on green, then goes to amber – red – amber – green again.

*Hint – You’ll need to flip flop!*

## Resources