Program the Rover to perform a distance survey of the area around it. Have the Rover turn on the spot and print out the value of one of the IR distance sensors at intervals around the circle.
Setup
The IR distance sensors have a maximum range of approximately 125 cm. If nothing is detected, an IR sensor reads 255.0 cm. Place the Rover amongst a collection of objects, run the code, and see if a partner can describe where the objects were just by reading the distances the Rover prints out. This can be done faster by using both IR sensors and only turning 180°.
Our Approach
Stage 1: Loop 15 Times
Our objective is to get 15 readings from the environment. You might use a different number of readings, start with a loop block that repeats 15 times. If you’re missing obstacles, try a higher number.
Stage 2: Turn a Fraction of a Circle
Add a Turn by Degrees motor block inside the loop. To complete a full 360° circle after 15 iterations, the block needs to turn one-fifteenth of a circle each time. Use a math operation block to divide 360 by 15.
Stage 3: Print the IR Distance
Finally, print the IR distance value. The Print block will send the IR value to the console.

Example code, 15-step distance survey



