The Grove Ultrasonic Ranger is a non-contact distance measurement module. It has a measuring range of 2 - 350cm, with a resolution of 1cm.

Ultrasonic Ranger

Hardware

The ultrasonic ranger should be plugged into a digital port on your Grove shield:

Digital ports on the Grove shield v2.0

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)