www.colmac.ie
44
In the first
Compare
command the LDRs are set so that if they both read less than 190 i.e. they are
both detecting the black line, then both motors are on moving the robot forward.
In the second
Compare
command if A0 reads more than 190 then the robot has moved off the line
to the right and motor M3 is turned off in order to turn the robot left and back to the line.
In the third
Compare
command if A2 reads more than 190 then the robot has moved off the line to
the left and motor M4 is turned off in order to turn the robot right and back to the line.
Visit
for videos
showing the
program being
tested using
Debug Live
and
the robot
following the GP
track.
NOTE:
Remember to use
your own LDR readings in
the
Compare
commands.