Sensor Appendix
EV3 Basic does a good job auto-detecting many sensors, at least all sensors that came with the NXT 2.0 and EV3 kit. Nevertheless the program needs to know how to best interpret the sensor readings for the different types and modes. To keep the list simple, I only include the modes which, I feel, make sense to use anyway. The EV3 sensors are listed first and the NXT sensors are listed in a separate table lower down.
Use ReadPercent(port number) to obtain a single value in the range 0-100.
Use ReadRawValue(port number, index) if you need to obtain a single non-percentage value, such as a color code. The index value for ReadRawValue should normally be zero except if you need to obtain value1 or value2 from the sensor, as shown in the table below.
Use ReadRaw(port number, number of elements) when you need to obtain multiple values from the sensor (in an array). See the sensor page and the manual.
EV3 Sensors
The IR beacon (remote control transmitter) can be switched to use one of 4 channels (slider on top position is channel 1) and the IR sensor (remote receiver) can detect all channel signals at the same time.
(*) numbers for the remote control buttons (A=left top, B=left bottom, C=right top, D=right bottom, E=beacon activated):
A = 1 A&B = 10 B&C = 7
B = 2 A&C = 5 B&D = 8
C = 3 A&D = 6 C&D = 11
D = 4
E = 9
other combinations give a reading of 0
(**) Note that the gyro sensor measures turn angles in degrees but Small Basic trigonometric functions use radians. Know that 1 radian = 57.3° approx.
(***) Assuming you are using a single IR remote control and thus a single channel.
NXT Sensors
(****) The webmaster says: I am unable to obtain mode 2 (color detect) of the NXT color sensor. Is my sensor broken?