Week 16 · Unit 7: Computers and robots · 3 lessons
3
Machines with computers inside
Computing 3: Unit 7, pp. 105–118
GoalExplain that a computer-controlled device takes an input, follows a program and gives an output.
New words
computer-controlled device · a machine that has a computer inside to control what it doesinput · information that goes into a machine, such as a button pressoutput · what the machine does or shows because of the program
Explanation
Many machines have a computer inside that controls them. They can be found in homes, shops, streets and factories. A computer-controlled device takes an input, for example a button press or a signal from a sensor. The computer follows its program. The program decides the output, which is what the machine does, such as opening a door or switching on a light. A different program can give a different output, even when the input is the same.
input→program→output
Worked examples
Machine
Input
Output
shop door
a sensor sees a person
the motor opens the door
street lamp
a sensor sees that it is dark
the lamp switches on
lift
you press the button for floor 3
the motor takes the lift to floor 3
Look at these three machines. Each one gets an input, the program decides, and the machine does something.
Program
Someone walks by in daylight
Someone walks by at night
Program 1
light on
light on
Program 2
light stays off
light on
The same input can give different outputs if the program is different. Here the sensor sees someone walk by in a hallway. Program 1 switches on the light. Program 2 switches on the light only when it is also dark.
a button press→the computer follows its program→a motor turns
Computers inside a machine do the same three jobs as the one on your desk: input, process (follow the program) and output.
Class activity
Be the machine (in pairs): one child is the street lamp’s computer, the other is the sensor. The sensor shows a card that says DARK or LIGHT. The program card on the table says “If the card says DARK, say lamp on. Otherwise say lamp off.” The computer follows the program. Now change the program card to “If the card says LIGHT, say lamp on.” Is the output different? Why? The input did not change but the program did.
Practice
1
Put these in the order they happen at an automatic shop door: (a) the door opens (b) the computer decides to open the door (c) a sensor sees a person.
?→?→?
c, b, a: input, program, output.
2
A lift: you press the button for floor 4. What is the input? What is the output?
The input is the button press. The output is the motor taking the lift to floor 4.
3
Name two machines in your home or school that have a computer inside.
For example: a washing machine, a microwave, a traffic light, a lift or a sprinkler timer.
4
A garden sprinkler can run Program A or Program B. It rained all day, so the soil is wet. Which program waters the garden this evening?
Program
The sprinkler waters the garden
Program A
every evening
Program B
every evening, but only if the soil is dry
Program A. Program B keeps the sprinkler off, because the soil is not dry. Same input (evening, wet soil), different program, different output.