Class MindsensorsDistanceSensorV2

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, SensorConstants, SensorMode, SensorModes, SampleProvider

    public class MindsensorsDistanceSensorV2
    extends I2CSensor
    Mindsensors DIST-Nx series of Optical Distance Sensors, Version 2
    Mindsensors DIST Sensor measure the distance to an object in front of the sensor using IR light

    Supported modes
    Mode name Description unit(s) Getter
    Distance Measures distance to an object in front of the sensor Meter getDistanceMode()
    Voltage Returns the output level of the sensors signal processing unit Volt getVoltageMode()

    Sensor configuration
    The sensor can be powered on and off using the powerOn and powerOff methods. It is useful to power off the sensor when not in use as it consumes a a fair bit of energy.
    The sensor can be tuned for a particular Sharp optical distance sensor using the setModule method. See the top of the sensor for the Sharp module installed on the sensor.
    The sensor supports hardware calibration but this in not supported by this interface.

    See Sensor datasheet See Sensor Product page See The leJOS sensor framework See leJOS conventions for SampleProviders

    Author:
    Michael Smith
    • Constructor Detail

      • MindsensorsDistanceSensorV2

        public MindsensorsDistanceSensorV2​(I2CPort port)
        Parameters:
        port - NXT sensor port 1-4
      • MindsensorsDistanceSensorV2

        public MindsensorsDistanceSensorV2​(I2CPort port,
                                           int address)
        Parameters:
        port - NXT sensor port 1-4
        address - I2C address for the sensor
      • MindsensorsDistanceSensorV2

        public MindsensorsDistanceSensorV2​(Port port)
        Parameters:
        port - NXT sensor port 1-4
      • MindsensorsDistanceSensorV2

        public MindsensorsDistanceSensorV2​(Port port,
                                           int address)
        Parameters:
        port - NXT sensor port 1-4
        address - I2C address for the sensor
    • Method Detail

      • init

        protected void init()
      • powerOn

        public void powerOn()
        Turns the sensor module on.
        Power is turned on by the constructor method.
      • powerOff

        public void powerOff()
        Turns power to the sensor module off.
      • setModule

        public void setModule​(byte module)
        Configure the sensor for a particular Sharp Module
        Parameters:
        module - See static fields for valid modules
      • getDistanceMode

        public SensorMode getDistanceMode()
        Returns a sample provider that measures distance (in meter).
      • getVoltageMode

        public SensorMode getVoltageMode()
        Returns a sample provider that measures the output level (in volt) of the sensors signal processing unit.