The Grove Ultrasonic Ranger is a non-contact distance measurement module. It has a measuring range of 2 - 350cm, with a resolution of 1cm.
Hardware
The ultrasonic ranger should be plugged into a digital port on your Grove shield:
Software
Functions that interact with the ultrasonic ranger are prefixed with ultra
.
Get distance control
To retrieve the measured distance in centimeters, call ultra_get_centimeters()
:
"""
* Get the distance reading from the ultrasonic sensor
*
* @params pin: Digital connection port
* @return distance in cm (range of 0 - 400 cm)
*
"""
def ultra_get_centimeters(pin)