Skip to the page
Year 9 · Summer 1 · Physical Computing

Inputs: buttons, light and temperature

PracticalPresent ▶

What this lesson covers

Topic 1 What a computer is

KS3 Computing · A computer takes information in, follows instructions to change it, gives a result out, and stores things for later. It does all of this with billions of tiny on/off switches.

Topic 13 Programming basics

KS3 Computing · A program stores information in variables, works on it with operators, and controls the order with sequence, selection and iteration. Examples are in Python, with Scratch alongside for Year 7.

Computer Systems ProgrammingCambridge Lower Secondary Computing 0860

You will learn to

  • Use digitalRead to read a button, and explain why the button needs a pull-down resistor.
  • Write an if that turns the light on only while the button is pressed.
  • Read the TMP36 sensor with analogRead and turn the reading into °C with the formula.
  • Explain what an ADC does: it turns a voltage into a number from 0 to 1023.

Success criteria

  • I can make a button change the light.
  • I can turn a reading of 153 into about 24.7 °C, step by step.
  • I can make the warning light come on above 30 °C.

Key words

Say each word, then read what it means. Every one is in the glossary too.

casting
Changing a value from one data type to another, like int("13").
Input / output
Anything that gets information into the computer. Keyboard, mouse, touchscreen, microphone, camera, a temperature sensor.
Process
The computer follows instructions to change that information. Add two numbers. Move a character. Sort a list. The CPU does this.
Transistor
An electronic switch with no moving parts.
Hardware
The physical parts of a computer.
Software
Programs: instructions that tell hardware what to do.
Embedded system
A small computer built into a device for one job.
Variable
A named place in memory that holds a value.
Assignment
Storing a value in a variable. = in Python, ← in pseudocode.
Concatenation
Joining strings together: "7" + "7" = "77".
Selection
Choosing a path with if / else.
Iteration
Repeating steps: a loop.
Boolean
A value that is only True or False.
Infinite loop
A loop whose condition never becomes false.

The explanation

Read it here, or open the study page below to go one step at a time with things to try.

Input, process, output

  1. Input: it receives information. You press a key, a microphone hears a sound.
  2. Process: it follows instructions to change that information. Add numbers, move a game character.
  3. Output: it gives a result back. Letters on a screen, sound from a speaker.
★Remember

Most computers also do storage: they keep information to use later.

e.g.Example

A washing machine is a computer too. Input: the dial. Process: choose a wash plan. Output: the drum turns.

Input and casting

name = input("What is your name? ")
age = int(input("How old are you? "))
print("Hi " + name + ", next year you'll be " + str(age + 1))
  1. input() always gives back a string, even if you type digits.
  2. int() turns "13" into 13 so you can do maths. This is casting.
  3. str() turns 14 back into text so it can join other text.

Study it

Open the study page and go one step at a time.

The steps for this lesson

The maths

Symbols first, then the words, then the equation. Change the numbers to try your own.

Build it

Check yourself

One question at a time. The reason shows after each answer.

Saved on this device.