Vous êtes sur la page 1sur 3

LEGO

MlNDS1OPMS

NX1 Ultrasonic Sensor l


2
C Communication Protocol
LEGO, the LEGO logo, MlNDS1OPMS and the MlNDS1OPMS logo are trademarks of the LEGO Group
2006 1he LEGO Group
Other product and company names listed are trademarks or trade names of their respective companies.
version. I.00

LEGO
O
MINDS1ORMS
O
NX1
UItrasonic Sensor
I
2
C Communication ProtocoI




LEGO

MlNDS1OPMS

NX1 Ultrasonic Sensor l


2
C Communication Protocol
2006 1he LEGO Group 2
version. I.00
The table documents the low-speed communication protocol which is used for communicating with the LEGO

MINDSTORMS

NXT Ultrasonic Sensor. Not all of these commands are


accessible within the software, but the ultrasonic sensor itself supports these commands and functionalities.

1ransmitted from NX1 Received in NX1
Command
Byte
0
Byte
! Byte 2 Length Byte 0
Byte
!
Byte
2
Byte
3
Byte
4
Byte
5
Byte
6
Byte
7
Byte
8 Comments
Addr.
Constants
Pead version 0x02 0x00 P + 0x03 8 0x56 0x3I 0x2E 0x30 0x00 vI.0
Pead product lD 0x02 0x08 P + 0x03 8 0x4C 0x45 0x47 0x4F 0x00 LEGO
Pead sensor type 0x02 0xI0 P + 0x03 8 0x53 0x6F 0x6E 0x6I 0x72 0x00 Sonar
Pead factory zero (Cal I) 0x02 0xII P + 0x03 I 0x00
Pead factory scale factor (Cal 2) 0x02 0xI2 P + 0x03 I 0x0I
Pead factory scale divisor 0x02 0xI3 P + 0x03 I 0x0E
Pead measurement units 0x02 0xI4 P + 0x03 7 0x3I 0x30 0x45 0x2D 0x32 0x6D 0x00 I0E-2m

VariabIes
Pead continuous measurements interval 0x02 0x40 P + 0x03 I lnterval
Pead command state 0x02 0x4I P + 0x03 I Command state
Pead Measurement Byte 0 0x02 0x42 P + 0x03 I Pesult I
Pead Measurement Byte I 0x02 0x43 P + 0x03 I Pesult 2
Pead Measurement Byte 2 0x02 0x44 P + 0x03 I Pesult 3
Pead Measurement Byte 3 0x02 0x45 P + 0x03 I Pesult 4
Pead Measurement Byte 4 0x02 0x46 P + 0x03 I Pesult 5
Pead Measurement Byte 5 0x02 0x47 P + 0x03 I Pesult 6
Pead Measurement Byte 6 0x02 0x48 P + 0x03 I Pesult 7
Pead Measurement Byte 7 0x02 0x49 P + 0x03 I Pesult 8
Pead actual zero (Cal I) 0x02 0x50 P + 0x03 I 0x00




LEGO

MlNDS1OPMS

NX1 Ultrasonic Sensor l


2
C Communication Protocol
2006 1he LEGO Group 3
version. I.00
Pead actual scale factor (Cal 2) 0x02 0x5I P + 0x03 I 0x0I
Pead actual scale divisor 0x02 0x52 P + 0x03 I 0x0E

Commands
Off Command 0x02 0x4I 0x00
Single shot command 0x02 0x4I 0x0I
Continuous measurement command (default) 0x02 0x4I 0x02
Event capture command 0x02 0x4I 0x03
Pequest warm reset 0x02 0x4I 0x04
Set continuous measurement interval 0x02 0x40 "lnterval"
Set actual zero (Cal I) 0x02 0x50 "value"
Set actual scale factor (Cal 2) 0x02 0x5I "value"
Set actual scale divisor 0x02 0x52 "value"


Single shot command:
In this mode the ultrasonic sensor will only make a new measurement every time the command byte is send to the sensor. The sensor will measure distances for up to 8 objects and save the
distances within the Read measurement byte 0 7.

Continuous measurement command:
This is the default mode, where the sensor continuously makes new measurement with the specified interval.

Event capture command:
Within this mode the sensor will measure whether any other ultrasonic sensors are within the vicinity. With this information a program can evaluate when it is best to make a new
measurement which will not conflict with other ultrasonic sensors.

Vous aimerez peut-être aussi