Datasheet

Table Of Contents
28
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 7 – Line Tracker Program
The following program demonstrates using your Microbot as a black line
follower. A suitable line can be created by sticking black insulation tape
onto a pale colour background (e.g. a piece of MDF wood).
Your Microbot should have the line tracker sensor fitted to the centre
front connection of the motherboard ( pin C.2 / ADC 8 ) and the
bumper and its two bump sensors should be fitted to the left and right
front connections ( pin C.1 and pin C.3 ).
When placed on a black line your Microbot will move forward diagonally
until it leaves the black line, then it will move itself forward in the
opposite diagonal direction until it is back on the line. This process will
repeat so your Microbot tracks the edge of the black line.
If your Microbot collides with anything one of the two bumper switches
will be activated. When the bumper switches are activated your Microbot
will stop until the obstacle is removed. When the bumper is free it will
then begin its line following again.
Sample Logicator Flowchart File:
BOT120 LINE FOLLOWER.PLF
Sample BASIC File:
BOT120 LINE FOLLOWER.BAS
symbol MID_LEVEL = 180
main:
if pinC.1 = 1 or pinC.3 = 1 then
halt A
halt B
else
readadc 8, b1
if b1 < MID_LEVEL Then
forward A
halt B
else
halt A
forward B
end if
end if
goto main