VEX IQ Python API
Public Member Functions | List of all members
vexiq.DistanceSensor Class Reference

Config Ultrasonic distance sensor. More...

Public Member Functions

def __init__ (self, port=None, unit=UNIT_CM)
 
def set_unit_inch (self)
 Set the distance unit to inches. More...
 
def set_unit_cm (self)
 Set the distance unit to centimeters. More...
 
def set_unit_mm (self)
 Set the distance unit to millimeters. More...
 
def distance (self)
 Get the distance indicated by the sensor. More...
 

Detailed Description

Config Ultrasonic distance sensor.

Parameters
port1-12, None to autodetect. Default None.
unitUnit type: UNIT_CM, UNIT_MM or UNIT_INCH. Default UNIT_CM. For backwards compatibility, True is UNIT_INCH and False UNIT_CM.

Constructor & Destructor Documentation

◆ __init__()

def vexiq.DistanceSensor.__init__ (   self,
  port = None,
  unit = UNIT_CM 
)

Member Function Documentation

◆ set_unit_inch()

def vexiq.DistanceSensor.set_unit_inch (   self)

Set the distance unit to inches.

◆ set_unit_cm()

def vexiq.DistanceSensor.set_unit_cm (   self)

Set the distance unit to centimeters.

◆ set_unit_mm()

def vexiq.DistanceSensor.set_unit_mm (   self)

Set the distance unit to millimeters.

◆ distance()

def vexiq.DistanceSensor.distance (   self)

Get the distance indicated by the sensor.

Returns
number