Datasheet

Table Of Contents
33
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 8 – Infra-red Receiver
The following program demonstrates waiting for an IR Remote Control
key press and reporting what the key code value is of the key pressed.
Sample Logicator Flowchart File:
BOT120 INFRARED TEST.PLF
The following flowchart waits for a Remote Control key press and
then selects what to do based upon the key pressed. The Microbot
will continue to do as instructed until another key is pressed.
Sample Logicator Flowchart File:
BOT120 INFRARED.PLF
Sample BASIC File:
BOT120 INFRARED TEST.BAS
main:
irin C.0,b1
debug
goto main
Sample BASIC File:
BOT120 INFRARED.BAS
symbol KEY_UP = 16
symbol KEY_DOWN = 17
symbol KEY_LEFT = 19
symbol KEY_RIGHT = 18
symbol KEY_MINUS = 98
symbol KEY_PLUS = 11
symbol KEY_DIAG_CROSS = 20
main:
irin C.0, b1
select case b1
case KEY_UP
forward A
forward B
case KEY_DOWN
backward A
backward B
case KEY_LEFT
backward A
forward B
case KEY_RIGHT
forward A
backward B
case KEY_MINUS
low B.1, B.3
case KEY_PLUS
high B.1, B.3
case KEY_DIAG_CROSS
halt A
halt B
end select
goto main