Instructional Material: Exercise: Using an Optical Distance Sensor

Modern Robotics has an Optical Distance sensor designed for use with the Tetrix control system. This sensor can read the distance to a surface when the surface is within 15 centimeters of the sensor. The FTC SDK has a sample program you can use to experiment with the Optical Distance sensor. In AS, open the path FtcRobotController/java/[first package]/external.samples/SensorMROpticalDistance. You can enable this program and work with it but any changes you make will be overwritten at the next update of the SDK. You can copy the class to the teamcode area so any changes you make will be retained.

Here is a detailed discussion of the Optical Distance sensor on the Modern Robotics website. There is a link on the page to programming information. This is recommended viewing.

Note that with the REV Hub the MR Optical Distance sensor is plugged into an Analog port.

REV also has a distance sensor (combined with a color sensor) and you can find sample code at FtcRobotController/java/[first package]/external.samples/SensorREVColorDistance.

Note that with the REV Hub the color sensor is plugged into an I2C port and configured by adding the device to the I2C Bus number matching the physical I2C port you plugged the sensor into.

Material Type: 
Lab Activity
Education Level: 
Middle School
High School
Focus Subject: 
Computing / Computer Science
Robotics Software
HW Platform: 
Tetrix
SW Platform: 
Java
Interactivity Style: 
Mixed
Audience: 
Learner