V1.0.6 improvements

The improvements in version 1.0.6 are as follows:

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)