User manual
RP6 ROBOT SYSTEM - 4. Programming the RP6
Example 13: LDRs – Light sensors
Directory: <RP6Examples>\RP6BaseExamples\Example_06_LightDetection\
File: RP6Base_LightDetection.c
This program will output messages on the serial interface
The robot does not move in this example program!
This sample program demonstrates how to use the two light sensors. In order to in-
dicate which sensor is most intensely illuminated (or whether both sensors are illu-
minated equally) we use the StatusLEDs. Along with measurement values, the pro-
gram will continuously report these informations to the serial interface, too.
Example 14: Behaviour controlled robots 3
Directory: <RP6Examples>\RP6BaseExamples\Example_07_LightFollowing\
File: RP6Base_LightFollowing.c
ATTENTION: The robot will move in this example program!
Of course, the light sensors can be used to extend the robot's design by implementing
a behaviour named “FollowLight”:
The priority or “FollowLight” is below Escape and Avoid, but above Cruise, which im-
plies the “Cruise” behaviour will never be activated in this example unless the room is
very dark (as soon as both LDR-levels drop below 100, the “FollowLight” behaviour
will be deactivated).
The “FollowLight”-behaviour tries to follow bright light-sources or the to find the
brightest light spot in a room by using the LDRs. Of course the simple algorithm and
simple sensor arrangement may fail in special conditions – e.g. if the robot is confron-
ted with a great number of equivalent light sources. However the system can be quite
successful in a darkened room, if it tries to find an intense torch light.
This program uses the LEDs in a dual mode – if ACS is not reporting an obstacle, the
LEDs indicate which of both light sensors is detecting the highest intensity and as
soon as the ACS is reporting an obstacle, the LEDs indicate that.
This program completes the overview of examples for behaviour controlled robots by
simulating a simple insect behaviour. The robot behaves like a moth in searching and
tracing light sources and simultaneously avoiding obstacles.
The robot may be extended by using additional sensors on expansion modules and by
programming your own behaviours and improving existing behaviour functions. These
options largely depend on your own creativity and programming capabilities!
- 119 -










