成人论坛

are built into many and that we use in everyday life - not just our laptops, tablets and desktop computers.

When a computer is part of a larger system of devices that includes several types of and , we call it a control system.

A is built around a computer processor that stores and processes information.

This information comes from a range of input devices.

Output from the computer processor can be sent to physical output devices including motors, lights and sound generators. Output can also be used to control robotic elements.

Some input devices need human interaction, like keyboards, touchscreens and voice control systems.

Other input devices allow computers to collect information about conditions and respond to them without human interaction. They are a bit like our human senses and are called .

Back to top

Making sense of our senses

Humans can have up to five senses.

Each human sense has a special body organ or structure that gathers information about the conditions outside our body.

This information is sent into the body through special nerve cells as electrical signals that eventually reach the brain.

The brain then sends messages back out to the body, so that you can respond to what your senses detected.

Think about what happens when someone burns the toast!

  1. You will probably notice when your nose detects the smell of burning.
  2. Your nose sends the signals into your brain which processes the information.
  3. Your brain has memories about what to do if the toast is burning.
  4. Your brain checks these stored instructions and then sends signals out to your body to react to the information.
  5. You might shout a warning: "the toast is burning!" and ask an adult to turn the toaster off.
Back to top

Computers can have senses too

Sensors can gather information about conditions nearby just like our human senses. They send it into the control system, as an electrical input signal through wires and cables.

Just as our brain receives signals from our senses, the input signals reach the . The control system can then use instructions in a stored program to react to the information it has received.

It will send instructions back out as output to a range of different output devices that will help the control system respond to the conditions around it.

Let's go back to our burning toast example.

A smoke alarm does almost the same thing as your nose.

  1. It has a detector that can sense tiny particles of smoke in the air.
  2. When it notices smoke particles, it sends a signal into the computer processor inside the plastic body of the alarm.
  3. The computer processor has a stored program that will tell it how to respond.
  4. The computer processor follows the program instructions and sends a message out to the alarm output device, to tell it to make a loud sound.
Back to top

Programming sensors

When we write computer programs for control systems with input sensors, we often need to use selection.

Selection means that the program selects or chooses what to do depending on the answer to a question.

This question could be answered by information from a sensor.

Programs that use selection will often have commands that include words like: WHEN, IF and THEN.

Programs for control systems that use sensors will all follow a similar algorithm structure:

  • WHEN a signal is received from the sensor to say it has detected something, send a message to the computer processor.
  • IF the signal says conditions have changed or reached a certain level.
  • THEN send these instructions to the output devices to turn on a motor/light/sound device etc.

This is what the program for a smoke detector sensor might look like.

  • WHEN the device is switched on, it waits for a signal.
  • IF the sensor detects smoke in the air around it, it will then send a signal to the computer processor saying that smoke has been detected.

What are program events?

Programs used in control systems will also use a programming idea called an EVENT.

An event is when something specific happens. We can use events to make a program wait for a specific event to happen before it carries out the next command.

Programs that use events often have words like WHEN and UNTIL in them.

This is what the program for the alarm sound generator might look like.

  • WHEN it receives the signal from the smoke sensor to say that it has detected smoke (the event).
  • the sound generator will play the alarm sound UNTIL the reset button is pressed.
Back to top

Control systems and sensors in the real world

Computers and sensors can be used to control conditions in lots of different places.

You might have sensors in your home to control the outside lights. When light sensors detect that it is dark outside, the program that is part of the control system can instruct the lights outside to switch on.

A home thermostat
Image caption,
A home thermostat

Heating systems in many homes have a control system that includes a device called a thermostat.

A thermostat has a temperature sensor that sends messages to the computer processor to turn the heating up or down, depending on the room temperature.

The system keeps the temperature at a chosen level.

A home thermostat
Image caption,
A home thermostat

Take a look at some other examples of control systems in the real world

Image gallerySkip image gallerySlide 1 of 3, , Some cars can switch on the windscreen wipers automatically when the water sensor built into the windscreen detects rain falling on it.
Back to top

Activities

Back to top

Computing - Dance Mat Typing. game

Build and test your computing skills with different levels of touch type challenges

Computing - Dance Mat Typing
Back to top

More on Computer science

Find out more by working through a topic