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. Alternatively, you can do as I have often done on this site and simply consider that the US sensor measures in mm rather than 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
* 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