Top Banner
12

LO: Were learning to understand how logic applies to us when building applications.

Mar 31, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LO: Were learning to understand how logic applies to us when building applications.
Page 2: LO: Were learning to understand how logic applies to us when building applications.

Learning Objective

LO: We’re learning to understand how logic applies to us when building

applications.

Page 3: LO: Were learning to understand how logic applies to us when building applications.

Logic….A logic gate is a digital circuit

which either allows a signal to pass through it or to stop it.

There are seven basic logic gates: AND, OR, XOR, NOT,

NAND, NOR, and XNOR.

Page 4: LO: Were learning to understand how logic applies to us when building applications.

NOT GATE….

NOTGATE

Input Output

NOTGATE

HEAT DETECTOR(ABOVE 20 C)

CENTRALHEATING

ON

ON

OFF

OFF

A NOT gate (inverter) has only one input. It reverses the logic state.

Y = NOT A

Page 5: LO: Were learning to understand how logic applies to us when building applications.

AND GATE….

c

ANDGATE

ANDGATE

ON SWITCH FOR ALARM

PERSON SENSOR

BURGLAR ALARM

Input

Input

Output

ON/OFF

ON /OFF

ON/OFF

An AND gate can have two or more inputs. The output will be positive (true) when both inputs (the input one AND the input two) are positive (true). Y = A AND B

Page 6: LO: Were learning to understand how logic applies to us when building applications.

OR GATE….

Output

ORGATE

Input

Input An OR gate can have two or more inputs. The output will be positive (True) if at least one input is true.

Y = A OR B

ORGATE

FRONT DOORBELLSWITCH

BACK DOORBELLSWITCH

DOORBELL

ON/OFF

ON /OFF

ON/OFF

Page 7: LO: Were learning to understand how logic applies to us when building applications.

Task 1 – Truth Tables….• It is important to remember the rules of each

gate. For example• The NOT gate has only one input and therefore only

has one output. • The truth table below has been started for you,

see if you can finish it…INPUT A OUTPUT X

1

1

Page 8: LO: Were learning to understand how logic applies to us when building applications.

Task 1 – Logic Sheet• Using these rules, see if you can finish the other

two truth tables.

• The output is "true" if either or both of the inputs are "true." If both inputs are "false," then the output is "false.” – OR

• The output is "true" when both inputs are "true.” Otherwise, the output is "false.“ - AND

Page 9: LO: Were learning to understand how logic applies to us when building applications.

Task 2 – Drawing the gates

?

?

?

?ON YES,

She/He is OK

Good dancer

Good at sport

Blue eyes

Has a big nose

Name the logic gates. Test it by answering True or false (Yes or No) for each Input.

Task – Create a pattern of logic gates to find out if something is suitable. It could be the perfect video game or CD to listen to.

Page 10: LO: Were learning to understand how logic applies to us when building applications.

Task 3 – Applying the Logic• Now that you understand the rules, it time to

apply it to TouchDevelop.

• You’ve learnt about 3 different gates, you may need to compare items before making algorithms in the future.

• Can you think of things you might need to compare in a game?

Page 11: LO: Were learning to understand how logic applies to us when building applications.

Task 3 – Applying the Logic1. Using the lesson 10 video, create the 3 logic

gates as 3 separate programmes.2. Publish the program with your name so that

your teacher can search or it. 3. Once your teacher is happy with your Logic

gates, see if you can create variables and repeat the logic gates you illustrated previously.

Page 12: LO: Were learning to understand how logic applies to us when building applications.

Wrapping UP

Your teacher might pass around 3 torches around the room.

The teacher has one inputAnother student is the second input.

The 3rd student will need to turn the 3rd torch, on or off based on the gate mentioned by the teacher.