Knowledge Base

Get Ultrasonic getDistanceMode (EV3)

output-onlinepngtools__231_.png  This block works for EV3 Robot!

mceclip0.png

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. 

Was this article helpful?
0 out of 0 found this helpful

Comments

Please sign in to leave a comment.