Datasheet

Table Of Contents
34
revolution
(c) Copyright Revolution Education Ltd. Web: www.picaxe.co.uk Version 1.1 04/10
BOT120.PMD
BOT120 PICAXE-20X2 MICROBOT
Programming Example 9 – Infra-red Transmitter
By using the IR Transmitters it is possible for one Microbot to act like a
Remote Control for another. By using the appropriate command it is
possible to send what looks like a particular key press to every Microbot
waiting to receive a Remote Control key press.
Note that each IR Transmitter is controlled independently (if two
transmitters are used). To send a key press from both IR Transmitters it is
necessary to send the appropriate command twice, once to one
transmitter, a second time to the other.
To check the IR Transmitters are working fully you will need two
Microbots, one sending and one receiving and reporting what it has
received. The operation of the IR transmitters is invisible to the human
eye but can usually be observed by using a PC webcam, mobile phone
camera or camcorder.
Take care not to place any webcam, digital camera or camcorder
too close to the IR LEDs to view their operation as this may
permanently damage the image sensors. Observing the IR LEDs
in this manner is undertaken entirely at your own risk.
The following flowchart will use an IR transmitter connected to the
centre rear connector of the motherboard (B.0) to act as an automated
remote control which can control one (or more) other Microbot which
has been programmed to respond to remote control key presses as in the
previous infra-red receiving program.
The program repeatedly sends out a simulated up arrow press followed
by a down arrow press every five seconds. The receiving Microbot will
therefore move forwards for 5 seconds and then backwards for 5 seconds.
Sample Logicator Flowchart File:
BOT120 INFRA TRANSMIT.PLF
Sample BASIC File:
BOT120 INFRA TRANSMIT.BAS
symbol KEY_UP = 16
symbol KEY_DOWN = 17
main:
irout B.0, 1, KEY_UP
pause 5000
irout B.0, 1, KEY_DOWN
pause 5000
goto main