Light sensor

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Light sensor

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What data does a light sensor capture?
A The temperature of its surroundings
B The brightness (light level) of its surroundings
2. A light sensor is an input device or an output device?
A Output device
B Input device
3. Which system would use a light sensor to work out when it is getting dark?
A Automatic street lights
B A barcode scanner at a till
4. Why might a phone or laptop contain a light sensor?
A To adjust the screen brightness to suit the room
B To measure how fast the user is typing
5. How could a greenhouse use a light sensor?
A To check the plants get enough light, so blinds or lamps can be controlled
B To measure the acidity of the soil

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1light sensor AIF light_level < 60 THEN grow_lamp ← ON
2light level BA light sensor measures brightness (light level), not temperature. A temperature sensor measures how hot or cold it is.
3An automatic street light uses a light sensor to detect when it gets dark so the lamp can switch on CThe data a light sensor captures, showing how bright or dark it is
4A greenhouse uses a light sensor to check there is enough light for plants, and adds lamps if it is too dim DAn input device that measures how bright the light is and sends the light level to a computer
5A light sensor measures the temperature of a room EIF light_level < 30 THEN lamp ← ON
6Screen brightness: the light sensor is an output device that shows the picture FA light sensor is an input device. It measures the room light and sends it to the computer, which then changes the screen brightness.

Definitions

light sensor

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
_____ lightLevel
2.
INPUT lightLevel IF __________ < 30 THEN OUTPUT "Street light ON"
3.
IF lightLevel < 30 ____ streetLight ← "ON" ENDIF
4.
IF lightLevel _ 70 THEN screenBrightness ← 100 ENDIF
5.
IF lightLevel < 50 THEN ______ "Grow lamp ON" ENDIF

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A light <- ReadLight()
B IF light < 30 THEN
C lamp <- OFF
D ELSE
E lamp <- OFF
F ENDIF
Question 2
A light <- ReadLight(
B IF light > 70 THEN
C brightness <- 100
D ENDIF
Question 3
A WHILE light < 40 THEN
B growLamp <- ON
C light <- ReadLight()
D ENDWHILE
Question 4
A light <- ReadLight()
B IF light < 20 THEN
C streetLamp <- ON
D ENDWHILE
E OUTPUT light
Question 5
A reading <- ReadLight()
B level <- reading / 1023 * 100
C OUTPUT lvel
D IF level < 25 THEN
E lamp <- ON
F ENDIF

Answer Key

Light sensor
Section A: Quick Questions
Q1
B — The brightness (light level) of its surroundings
Q2
B — Input device
Q3
A — Automatic street lights
Q4
A — To adjust the screen brightness to suit the room
Q5
A — To check the plants get enough light, so blinds or lamps can be controlled
Section B: Match the Pairs
Q1
light sensor → An input device that measures how bright the light is and sends the light level to a computer
Q2
light level → The data a light sensor captures, showing how bright or dark it is
Q3
An automatic street light uses a light sensor to detect when it gets dark so the lamp can switch on → IF light_level < 30 THEN lamp ← ON
Q4
A greenhouse uses a light sensor to check there is enough light for plants, and adds lamps if it is too dim → IF light_level < 60 THEN grow_lamp ← ON
Q5
A light sensor measures the temperature of a room → A light sensor measures brightness (light level), not temperature. A temperature sensor measures how hot or cold it is.
Q6
Screen brightness: the light sensor is an output device that shows the picture → A light sensor is an input device. It measures the room light and sends it to the computer, which then changes the screen brightness.
Section C: Definitions
Q1
light sensor — An input device that measures how bright the light is and sends the light level to a computer. Used in automatic street lights, screen brightness and greenhouses.
Section D: Fill in the Blanks
Q1
INPUT lightLevel
Q2
INPUT lightLevel IF lightLevel < 30 THEN OUTPUT "Street light ON"
Q3
IF lightLevel < 30 THEN streetLight ← "ON" ENDIF
Q4
IF lightLevel > 70 THEN screenBrightness ← 100 ENDIF
Q5
IF lightLevel < 50 THEN OUTPUT "Grow lamp ON" ENDIF
Section E: Spot the Error
Q1
C — A low light level means it is dark, so the street lamp should be switched on. Line 3 should be lamp <- ON.
Q2
A — The function call is missing its closing bracket. It should be light <- ReadLight() so the light sensor's reading is stored in light.
Q3
A — A WHILE loop uses DO, not THEN. THEN belongs to IF statements. It should be WHILE light < 40 DO.
Q4
D — An IF statement must be closed with ENDIF, not ENDWHILE. There is no WHILE loop in this program.
Q5
C — The variable name is misspelled. The light level was stored in level, so it should be OUTPUT level.