public class MindsensorsDistanceSensorV2 extends I2CSensor
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
Modifier and Type | Field and Description |
---|---|
static int |
VOLT_DATA_LSB |
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
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 and Description |
---|
MindsensorsDistanceSensorV2(I2CPort port) |
MindsensorsDistanceSensorV2(I2CPort port,
int address) |
MindsensorsDistanceSensorV2(Port port) |
MindsensorsDistanceSensorV2(Port port,
int address) |
Modifier and Type | Method and Description |
---|---|
SensorMode |
getDistanceMode()
Returns a sample provider that measures distance (in meter).
|
SensorMode |
getVoltageMode()
Returns a sample provider that measures the output level (in volt) of the sensors signal processing unit.
|
protected void |
init() |
void |
powerOff()
Turns power to the sensor module off.
|
void |
powerOn()
Turns the sensor module on.
|
void |
setModule(byte module)
Configure the sensor for a particular Sharp Module
|
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public static final int VOLT_DATA_LSB
public MindsensorsDistanceSensorV2(I2CPort port)
port
- NXT sensor port 1-4public MindsensorsDistanceSensorV2(I2CPort port, int address)
port
- NXT sensor port 1-4address
- I2C address for the sensorpublic MindsensorsDistanceSensorV2(Port port)
port
- NXT sensor port 1-4public MindsensorsDistanceSensorV2(Port port, int address)
port
- NXT sensor port 1-4address
- I2C address for the sensorprotected void init()
public void powerOn()
public void powerOff()
public void setModule(byte module)
module
- See static fields for valid modulespublic SensorMode getDistanceMode()
public SensorMode getVoltageMode()