Package lejos.hardware.sensor
Class MindsensorsDistanceSensorV2
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.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 lightSupported 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
-
-
Field Summary
Fields Modifier and Type Field Description static intVOLT_DATA_LSB-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description MindsensorsDistanceSensorV2(I2CPort port)MindsensorsDistanceSensorV2(I2CPort port, int address)MindsensorsDistanceSensorV2(Port port)MindsensorsDistanceSensorV2(Port port, int address)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SensorModegetDistanceMode()Returns a sample provider that measures distance (in meter).SensorModegetVoltageMode()Returns a sample provider that measures the output level (in volt) of the sensors signal processing unit.protected voidinit()voidpowerOff()Turns power to the sensor module off.voidpowerOn()Turns the sensor module on.voidsetModule(byte module)Configure the sensor for a particular Sharp Module-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Field Detail
-
VOLT_DATA_LSB
public static final int VOLT_DATA_LSB
- See Also:
- Constant Field Values
-
-
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-4address- 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-4address- 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.
-
-