Learn EV3 Python‎ > ‎Using Sensors‎ > ‎

Sensor Modes

Recall that 
  • my site only discusses the standard EV3 and NXT sensors
  • the official EV3 Python sensor documentation is HERE
  • information about the different modes available for different Lego sensors can be found in the Lego section of the sensor-specific-resources section of THIS PAGE.
  • as of September 2016 the NXT light sensor does not work in color detection mode with EV3 Python
This page gives information on the sensor modes that I believe will be most useful to beginners. For other modes, see the official documentation in the Lego section of the sensor-specific-resources section of THIS PAGE. EV3 Sensors are listed first and then NXT sensors. It should be obvious what type of sensor is being referred to (infrared, ultrasonic, sound, touch etc). In the table, pct means percent and +-2550 means from -2550 to +2550. Dec means decimal places - see the next paragraph.

Warning: Some sensor modes return values that include one decimal place (Dec = 1 in the tables below, highlighted yellow). These values include a decimal place but not a decimal point(!) so you must take great care to handle these values correctly. The EV3 ultrasonic sensor in mode US-DIST-CM, for example, might return the value 184 which would actually not mean not 184 cm as you would expect, but 18.4 cm. Another example: if the NXT light sensor in mode REFLECT returns the value 50 (pct), this does not mean 50 percent, it means 5.0 percent since the value includes one decimal place! Therefore when using any of those modes I recommend you divide the value by 10 as it is being read to get the true value in the correct units. You can see this being done in the example programs on THIS PAGE.

EV3 Sensors

ModeDescription Units Dec Values
TOUCH Button state - 0 0 or 1
COL-REFLECT
COL-AMBIENT
COL-COLOR
RGB-RAW
Reflected light. LED color: red
Ambient light. LED color: blue (dimly lit)
Color. LED color: white
Raw Color Components. LED color: white
 pct
 pct
 col
 -
 0
 0
 0
 0
 0-100
 0-100
 0-7*
 **
US-DIST-CM
US-DIST-IN
Continuous measurement.
Continuous measurement.
 cm
 inch
 1
 1
 0-2550
 0-1003
GYRO-ANG
GYRO-RATE
Angle
Rotational speed
 deg
 d/s
 0
 0
 +-32767
 +-440
IR-PROX
Distance (100% is approximately 70cm/27in)
For other IR modes click HERE
 pct 0 100

0=unknown, 1=black, 2=blue, 3=green, 4=yellow, 5=red, 6=white, 7=brown

** returns 3 values, each 0-1023: value(0): Red , value(1): Green, value(2): Blue. For more information on this mode click HERE.

NXT Sensors

Mode            Description Units Dec Values
TOUCHButton state - 0 0 or 1
REFLECT
AMBIENT
COLOR
Reflected light intensity. LED on.
Ambient light intensity. LED off.
NOT YET WORKING!
 pct
 pct
 1
 1
 0-1000
 0-1000
DBSound pressure level (flat weighting) pct 1 0-1000
US-DIST-CM
US-DIST-IN
Continuous distance measurement
Continuous distance measurement
 cm
 in
 0
 1
 0-255
 0-1000
Comments