Lesson 9: Respond to light
Environmental measurement and programming mathematics – Students learn about measuring light levels, storing them in memory and performing mathematics to control the robots behaviour.
Understanding variables (Worksheet 9.1)
Students learn about what a variable is in computing and how to set one up in the Edison robot. They also learn about the two different sized variables; ‘bytes’ (8 bits – 0 to 255) and ‘words’ (16 bits -32,767 to +32,767).
Program 1 – Light level alarm (Worksheet 9.2)
Students write a program that sounds an alarm when the lights in the room are turned on. This program introduces the use of variables and basic mathematics using a ‘greater than’ (>) comparison.
Program 2 – Automatic lights (Worksheet 9.3)
Students write a program that drives the robot forward while monitoring light levels. If the robot drives into a dark area the front lights are automatically turned on. This program uses a ‘less than’ (<) comparison.
Program 3 – Light following (Worksheet 9.4)
Students write a program that drives the robot towards bright light, such as that from a torch/flashlight. This program introduces more computational mathematics, using subtraction and then a ‘less than’ (<) comparison.
Animal behaviours in robotics
The light following program above demonstrates a robot behaviour that is very similar to that of a moth on a warm night being attracted to a street light.
This can make a good discussion about the intelligence of both insects and robots.
Why is an insect that is attracted to light alive, but not a robot?