The NXT IRReceiver Sensor receives signals from a LEGO Power Functions IR remote control, decodes the information in the remote control signal and makes this available to an NXT program. The information received can be directly used to control NXT motors or your program can use the input data to control other functions within your program.
The IRReciever Sensor will receive signals from the LEGO Power Functions IR Speed Remote Control and the Power Functions IR Remote Control.
Power Functions IR Speed Remote Control Item #8879 Power Functions IR Remote Control Item #8885
Programming
MINDSTORMS NXT-G Programming
NXT-G programs can use the sensor data and wire it directly to motor blocks to create a very simple R/C program.
This block returns the latest remote control settings received from the remote each time you execute the block in your program. Each Remote Control has 2 motor controls, Red and Blue which are matched on the block data hub.
You must drag at least one output data wire from this block's data hub to another block for any information to be sent.
Display Settings
The number shows which of your NXT's ports are connected to the IRReceiver. You can change this number in the configuration panel if you need to.
The block's data hub will open automatically when the block is placed in the work area. At least one data wire must be dragged from the block's output plug to another block's data hub. (See the Data Hub section below for more information.)
Configuring the IRReceiver Block
Port: Choose the port where your IRReceiver is plugged in. By default, the block will be set to port 4 for an IRReceiver. You can change this selection if you need to.
Channel: Chose the channel to match the channel selected on the LEGO Power Functions Remote Controller (1 - 4).
IRReceiver block Data Hub plugs
You must click on the Data Hub to open it as shown.
The port that the IRReceiver is connected to
The Power Functions Remote Control channel number (match channel selected on the remote control)
The Red Motor Direction (Remote Control red channel)
The Red Motor Power
The Blue Motor Direction (Remote Control blue channel)
The Blue Motor Power
The Red Motor Brake
The Blue Motor Brake
The Red Control setting
The Blue Control setting
This chart shows the different characteristics of the plugs on the IRReceiver data hub:
Plug |
Data Type |
Possible Range |
What the Values Mean |
Port |
Number |
1 - 4 |
1 = Port 1, 2 = Port 2, 3 = Port 3, 4 = Port 4 |
Channel |
Numeric |
1 - 4 |
1 = Channel l, 2 = Channel 2, 3 = Channel 3, 4 = Channel 4 |
Direction |
Logic |
True/False |
True = Forwards
False = Backwards |
Power |
Number |
0 - 100 |
|
Brake |
Logic |
True/False |
True = Brake
False = Coast |
Setting |
Number |
-7 - +7 |
Remote speed control setting |
Other Programming Environments
IRReceiver Register Layout
Address
|
Type
|
Contents
|
00 – 07H
|
chars
|
Sensor version number
|
08 – 0FH
|
chars
|
Manufacturer
|
10 – 17H
|
chars
|
Sensor type
|
18 – 3DH
|
bytes
|
Not used
|
3E, 41H
|
chars
|
Reserved
|
42H
|
byte
|
Motor 1A control
|
43H
|
byte
|
Motor 1B control
|
44H
|
byte
|
Motor 2A control
|
45H
|
byte
|
Motor 2B control
|
46H
|
byte
|
Motor 3A control
|
47H
|
byte
|
Motor 3B control
|
48H
|
byte
|
Motor 4A control
|
49H
|
byte
|
Motor 4B control
|
The Motor 1A/1B/2A/2B/3A/3B/4A/4B control fields indicate the power control for motors 1A through 4B. The number 1/2/3/4 is decoded from the remote controls selected channel. The letter A/B indicates left (Red) or right (Blue) control, A – left, B – right.
The following range values will be returned; -128, -100, -86, -72, -58, -44, -30, -16, 0, 16, 30, 44, 58, 72, 86 and 100. -128 is returned to signal motor brake.
The IR Receiver can be programmed using any of the available programming languages including NXC, RobotC and LabVIEW.
These and other HiTechnic sensor programming blocks are available from the downloads page.
Downloads