EV3 populate distance from either IR or UltraSonic sensor. #2306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves
#1445
Proposed Changes
In the EV3 Scratch extension, allow the distance to be populated from an IR sensor if installed.
Reason for Changes
This is useful since the EV3 commercial kit (Lego 31313) contains only an IR sensor for distance sensing whereas educational kits (Lego 45544) contains the already supported UltraSonic sensor. This allows those with the commercial kit to use all Scratch EV3 features.
Note
The range of values from the IR sensor matches what comes from the UltraSonic sensor, but the units are different. The UltraSonic returns values between 0 and 100 inches (the extension hard-codes it to inches mode), and the IR sensor returns "proximity" in the range of 0 to 100%, where 100% corresponds to "approximately 50-70cm". This is no different from how the sensors report in native EV3 programming.