3.9 The Infrared Receiver
The Infrared Receiver module allows you to simply control your Versabot using a TV-like remote
control. The TV remote control, if required, is available separately as part TVR010.
1. Attach the Infrared Receiver module to Pin 6 on the Versabot motherboard.
2. In order to use the remote control with the microcontroller, you will need to follow a sequence
of steps to preset the remote to work with the microcontroller.
a. Put two AAA batteries into the remote control unit.
b. Simultaneously hold down the S button (in the middle of the arrows) and the B button
on the remote (a red light will go on in the top left hand corner of the remote.)
c. Press the number sequence 0 1 3 on the remote buttons.
d. Press the red power button on the remote.
e. The remote is now configured to work with your microcontroller.
Note that buttons A, C, D, E, F and G are for setting the remote control into different modes which
are not required for this project. Avoid pressing these buttons as this will inadvertently set your
remote into another mode. You can always return to the ‘B’ mode by pressing the B button.
3. Start the
Programming Editor
or
AXEpad
, or start a new program by using the
File/New/Basic Program menu option.
4. In this program you will be using the
infrain
command. This is a command that tells the
microcontroller to wait for a remote control signal.
'**Variables**
symbol
keyPressed
= w0
symbol
timeout
= w1
'**PICAXE motherboard pin definitions**
symbol
P0
= B.0
symbol
P2
= B.2
symbol
P4
= B.4
symbol
P6
= B.6
'**PICAXE motherboard input definitions**
symbol
IN6
= pinB.6
'**IR Remote Keys**
symbol
KEY_UP
= 16
symbol
KEY_DOWN
= 17
symbol
KEY_LEFT
= 19
symbol
KEY_RIGHT
= 18
high
P4
' Initialise motor
do
gosub
ReadIrCommand
' Read the IR command
gosub
ObeyIrCommand
' Obey the IR command
loop
Содержание Versabot
Страница 1: ...The Versabot Manual July 2009...
Страница 23: ...Step 03 Step 04 Step 05...
Страница 24: ...Step 06 Step 07 Step 08...
Страница 25: ...Step 09 Step 10 Step 11...
Страница 26: ...Step 12 Step 13...