Datasheet

Table Of Contents
40
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 13 – Using the SRF005
The following program will move the Microbot forwards until it detects
an obstacle 5 cm in front of it. It will then stop until the obstacle is
removed.
Sample Logicator Flowchart File:
BOT120 SRF005.PLF
Sample BASIC File:
BOT120 SRF005.BAS
main:
pause 10
pulsout C.2, 2
pulsin C.2, 1, w0
w1 = w0 * 5 / 58 ; Convert to cm
if w1 > 5 then
forward A
forward B
else
halt A
halt B
end if
goto main