| cmdIR02_RD | Index |
Command Code:
The Packet:
Description:
This command retrieves data from a Sharp GP2D02 IR ranging device. A GP2D02 input ID that is out of range will generate an error message.
If the HOST bit is set, the BrainStem will send a cmdDEV_VAL reply packet to the host . The reply packet echoes the GP2D02 input ID in the first data byte and contains the 1-byte distance reading in the remaining byte. If the RFLX bit is set, the value will go directly to a reflex routine within the BrainStem. The HOST bit and the RFLX bit may be set at the same time.
The following table shows the Console command and a sample reply when requesting a GP2D02 reading from a BrainStem with an address of 2. (The Console program automatically inserts a size byte into the command packet and extracts the size byte from the reply packet.)
| GP2D02 Input | Device ID | Console Input | Sample Reply |
| 0 | 10 (0x0A) | 2 30 128 | 02:04,0A,E4 |