Datasheet

Table Of Contents
22
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 3 – Bumper
If the front bumper has been fitted then the left bumper switch will be
connected to Input Pin C.1 and the right bumper switch will be
connected to Input Pin C.3.
A bump on the left will set ‘Input Pin C.1’ to 1, a bump on the right will
set ‘Input Pin C.3’ to 1, a central bump will set both ‘Input Pin 1’ and
‘Input Pin C.3’ to 1. The values of ‘Input Pin C.1’ and ‘Input Pin C.2’ can
therefore be used to determine what appropriate action to take when a
bump or collision occurs.
This program will light the left LED eye if the left bumper is pressed and
the right LED eye if the right bumper is pressed
Sample Logicator Flowchart File:
BOT120 BUMPER SWITCH TEST.PLF
Sample BASIC File:
BOT120 BUMPER SWITCH TEST.BAS
main:
if pinC.1 = 1 then
high B.1
low B.3
else if pinC.3 = 1 then
low B.1
high B.3
else
low B.1
low B.3
end if
goto main