Generally writing about sensors make the subject appear
complex. Using sensors, particularly with the Roamer, is much easier than
it may seem, and the more you practice, the easier it gets! Marcus Topham
continues his look at Roamer Sensors.
Roamer's sensor system is just like that of humans: the act of switching
on a lamp (stimulus) is detected by a light sensor that transmits a signal
to the Roamer's microprocessor brain.
If the Roamer recognises the signal it will respond by executing a sense
procedure. A sense procedure is like any other Roamer procedure except
that it is referred to in a sense instruction and should not be used as
part of the GO Program.
Sensors react in different ways: some light sensors will cause a
High to Low signal when a light is switched on and other designs will
cause a Low to High signal. You need to find out how the particular
sensor you are using acts. In the examples here it is assumed that
the sensor causes a High to Low signal when a change from dark to
light occurs.
The Roamer Sense Instruction
The Roamer sense instruction needs to tell Roamer which type of signal
to recognise and then which sense procedure to execute.
To enter a sense instruction, press S followed by a number from 1 and
5 for the type of input signal to recognise and a number betwen 1 and
99 for the sense procedure.
Using the Sense Instruction
The sense instruction can be used anywhere in the GO Program.
When the Roamer executes a sense instruction, it remembers what type
of signal to recognise and what procedure to execute if the signal occurs.
It then continues to execute the GO Program. If it receives the correct
signal, it immediately stops executing the GO Program and executes the
sense procedure. Once the sense procedure has been executed, the Roamer
returns to where it left the GO Program and executes the remaining instructions.
If the correct signal occurs again the Roamer will execute the sense
procedure again and then return once more to the GO Program.
Types of Signal Recognised by Roamer
A High to Low signal (e.g. a dark to light change).
A Low to High signal (e.g. a light to dark change).
Either a High to Low or a Low to High signal (e.g. a dark to light
or a light to dark change).
Roamer will recognise if the Input line is Low when the sense instruction
is executed or if a High to Low signal occurs (e.g. if it is light
when the sense instruction is executed or if it changes from dark
to light).
Roamer will recognise if the Input line is High when the sense instruction
is executed or if a Low to High signal occurs (e.g. if it is dark
when the sense instruction is executed or if it changes from light
to dark).
Examples of Sense Instructions
The Roamer recognises a High to Low signal and responds by
executing procedure 5.
The Roamer recognises a Low to High signal and responds by
executing procedure 1.
The Roamer recognises a High to Low Signal or recognises if
the input line is Low when the sense instruction is executed
it responds by executing procedure 1.
All good stuff! Explaining how to use sensors always appears more
difficult than actually using them. The practical programming of
the following examples should help develop an understanding of the
basic ideas.
What is a Signal?
A signal in electronic parlance is a change of voltage from
a High level to a Low level or vice versa.
A High to Low signal (Voltage change)
A Low to High signal (Voltage change)
Roamer uses High/Low terminology for programming Inputs and
Outputs.
Note: Roamer's Input line is normally High.
Dog Training
Make the Roamer look like a dog, fit it with a sound sensor and
program it to come when whistled at.
GO Program
Program Roamer to recognise either a High to Low or a Low to High
signal and respond by executing sense procedure 1.
Wait for 20 seconds.
Sense Procedure
Move forward 5 units.
Finding the Door
The object of this activity is to program Roamer to find its way
through a doorway. Play acting the activity can be valuable. Blindfold
the pupil and ask him or her to find the doorway. They are only
allowed to walk forward, backward or turn 90° left or right; that
is, they are not allowed to 'side-step'
Fit Roamer with touch sensors.
GO Program
Program Roamer to recognise a High to Low signal and respond
by executing sense procedure 51.
Move forward 25 units.
Move along the wall and try again.
Car Headlights
Make the Roamer into a car with a pair of headlights and fit it
with a light sensor.
Activity 1: Put the Roamer car in a room with daylight blocked
out. The room lights should be on. Program the Roamer car to turn
on its headlights when the room lights are switched off. (Note:
the headlights are made from two lamps connected into Output 1 of
the Control Box).
GO Program
Sense instruction: when a High to Low signal occurs (the room becomes
dark) execute procedure 3 and then continue with the GO Program.