This block works for EV3 Robot!
The getDistanceMode block samples the Ultrasonic sensor's readings. It can be used as a value or as a condition in a loop, to act according to the robot's distance from an object.
In this example code, the robot will stop when it is less than 20 cm away from the wall:
As a bonus, we also added a Print block within the loop to print the current distance to the console.
Comments
Please sign in to leave a comment.