V1.0.6 improvements
The improvements in version 1.0.6 are as follows:
A new function Sensor.ReadRawValue(port number, index) has been added. You should use this new function when you need to obtain from a sensor a single value that is not a percentage (percentage values should be read with ReadPercent). In other words, the new function is perfect for obtaining a color code from the color sensor (1=black, 2=blue etc), a distance in mm from the EV3 ultrasound sensor, an angle in degrees from the gyro sensor, and more. The advantage of ReadRawValue over ReadRaw is that it returns a simple number variable instead of an array. The index parameter will almost always be zero for the new function, except in certain cases where you may need to obtain value1 or value2 from the sensor array as indicated in the sensor appendix. For more information on sensors see the sensor page.
Sensor.SetMode now waits until the sensor is ready before attempting a change of mode. This means it is no longer necessary to run Sensor.Wait before Sensor.SetMode. The modified command also waits for sensor data to become available before allowing program execution to continue, so it is no longer considered advisable to run Sensor.Wait after Sensor.SetMode
Motor commands will always use the absolute value of the degree parameter. In other words, any negative sign for the angle will be ignored. This is an improvement relative to the previous behaviour which was different for the different motor commands. The message is clear: if you want a motor to run backwards you must set the speed or power to be negative and not the angle.
I (with the kind help of Frédéric Maria of the Pobot robotics club in Sophia Antipolis near Cannes, France) have completed the translation of the EV3 extension documentation into French. So the extension is now available in three languages: English, French and German.
The official documentation ('Intellisense' and EV3 Basic manual) has been improved.
The first two improvements above allow for much neater code to be used for working with sensors. It's no longer necessary to have to deal with a sensor giving a single value inside an array (that's not what arrays are for!) Take as an example the programs below which are both designed to make the EV3 play a tone when an object approaches within 10cm (100mm) of the EV3 ultrasonic sensor on port 4. The first program shows the code that was needed in v1.0.5 (11 lines) and the second program shows the code that is needed in v1.0.6 (4 lines). So the improvements in v1.0.6 allow this program to be 64% shorter than before, and much more legible!
Version 1.0.5:
Sensor.Wait(4) 'wait until sensor is ready for mode change
Sensor.SetMode(4,0) 'set mode to 0 : measure distance in mm
Sensor.Wait(4) 'wait until sensor data is available
Loop="True" 'loop control variable
While Loop
DistanceArray=Sensor.ReadRaw(4,1) 'get array with 1 value
If (DistanceArray[0])<100 Then
Loop="False" 'prevent repetition of loop
EndIf
EndWhile
Speaker.Tone(100,500,1000) '(volume, frequency, duration)
Version 1.0.6:
Sensor.SetMode(4,0) 'set mode to 0 : measure distance in mm
While Sensor.ReadRawValue(4,0)<100 'while distance < 100 mm
EndWhile
Speaker.Tone(100,500,1000) '(volume, frequency, duration)