Distance Sensors
Determining Distance to Objects
The REV 2M distance sensor is the best bet for teams looking to make use of a distance sensor in their code. This time-of-flight sensor is very useful for determining the robots distance from objects, up to 2 meters.
Implementation
Initialize the Sensor
Finding the distance returned by the sensor
Using the Sensor Values
You can use the sensor to do an action if it is below a certain distance threshold to an object.
You can also use the sensor to do something if it is more than a certain distance away from an object.
Last updated