|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.I2CSensor lejos.nxt.addon.OpticalDistanceSensor
public class OpticalDistanceSensor
Supports Mindsensors DIST-Nx series of Optical Distance Sensor.
This sensor is used for greater precision than the Ultrasonic Sensor.
Field Summary | |
---|---|
static byte |
CUSTOM
Custom sensor |
static byte |
GP2D12
|
static byte |
GP2D120
DIST-Nx-Short |
static byte |
GP2YA02
DIST-Nx-Long |
static byte |
GP2YA21
DIST-Nx-Medium |
Fields inherited from class lejos.nxt.I2CSensor |
---|
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, 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 | |
---|---|
OpticalDistanceSensor(I2CPort port)
|
|
OpticalDistanceSensor(I2CPort port,
int address)
|
Method Summary | |
---|---|
int |
getCurveCount()
Gets the number of points that will be in the curve. |
int |
getDistance()
Returns the distance from the object in millimeters. |
int |
getDistLSB()
Returns the current distance in millimeters for the LSB. |
int |
getDistMaxLSB()
Gets the max value in millimeters for the LSB. Used for recalibrating the sensor. |
int |
getDistMaxMSB()
Gets the max value in millimeters for the MSB. Used for recalibrating the sensor. |
int |
getDistMinLSB()
Gets the min value in millimeters for the LSB. Used for recalibrating the sensor. |
int |
getDistMinMSB()
Gets the min value in millimeters for the MSB. Used for recalibrating the sensor. |
int |
getDistMSB()
Returns the current distance in millimeters for MSB. |
int |
getDistPointLSB(int index)
Gets millimeter value of the specific index for the LSB. Used for recalibrating the sensor. |
int |
getDistPointMSB(int index)
Gets millimeter value of the specific index for the MSB. |
float |
getRange()
Returns the range to the object in centimeters. |
float[] |
getRanges()
If the sensor is capable, this method returns multiple range values from a single scan. |
int |
getSensorModule()
Used to determine the sensor module that is configured. |
int |
getVoltLSB()
Returns the current voltage level in millivolts for the LSB. |
int |
getVoltMSB()
Returns the current voltage level in millivolts for the MSB. |
int |
getVoltPointLSB(int index)
Gets millivolts value of the specific index for the LSB. |
int |
getVoltPointMSB(int index)
Gets millivolts value of the specific index for the MSB. |
void |
powerOff()
Turns power to the sensor module off. |
void |
powerOn()
Turns the sensor module on. |
void |
setAPDAOff()
Disables (ADPA) Auto Detecting Parallel Architecture. Disabled by default. |
void |
setAPDAOn()
Enables (ADPA) Auto Detecting Parallel Architecture. |
void |
setCurveCount(int value)
Sets the number of points that will be in the configured curve. |
void |
setDistMaxLSB(int value)
Sets the max value in millimeters for LSB. Used for recalibrating the sensor. |
void |
setDistMaxMSB(int value)
Sets the max value in millimeters for the MSB. Used for recalibrating the sensor. |
void |
setDistMinLSB(int value)
Sets the min value in millimeters for the LSB. Used for recalibrating the sensor. |
void |
setDistMinMSB(int value)
Sets the min value in millimeters for the MSB. Used for recalibrating the sensor. |
void |
setDistPointLSB(int index,
int value)
Sets millimeter value of the specific index for the LSB. |
void |
setDistPointMSB(int index,
int value)
Sets millimeter value of the specific index for the MSB. |
void |
setSensorModule(byte module)
This only needs the be run if you are changing the sensor. |
void |
setVoltPointLSB(int index,
int value)
Sets millivolts value of the specific index for the LSB. |
void |
setVoltPointMSB(int index,
int value)
Sets millivolts value of the specific index for the MSB. |
Methods inherited from class lejos.nxt.I2CSensor |
---|
fetchString, getAddress, getData, getData, getPort, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte GP2D12
public static final byte GP2D120
public static final byte GP2YA21
public static final byte GP2YA02
public static final byte CUSTOM
Constructor Detail |
---|
public OpticalDistanceSensor(I2CPort port)
port
- NXT sensor port 1-4public OpticalDistanceSensor(I2CPort port, int address)
port
- NXT sensor port 1-4address
- I2C address for the sensorMethod Detail |
---|
public void setSensorModule(byte module)
module
- changes the sensor module attached the he board.public int getDistance()
public float getRange()
getRange
in interface RangeFinder
public void powerOn()
public void powerOff()
public void setAPDAOn()
public void setAPDAOff()
public int getDistLSB()
public int getDistMSB()
public int getVoltLSB()
public int getVoltMSB()
public int getSensorModule()
public int getCurveCount()
public void setCurveCount(int value)
value
- max 39public int getDistMinLSB()
public void setDistMinLSB(int value)
value
- intpublic int getDistMinMSB()
public void setDistMinMSB(int value)
value
- intpublic int getDistMaxLSB()
public void setDistMaxLSB(int value)
value
- intpublic int getDistMaxMSB()
public void setDistMaxMSB(int value)
value
- intpublic int getVoltPointLSB(int index)
index
- max 39
public void setVoltPointLSB(int index, int value)
index
- max 39value
- intpublic int getVoltPointMSB(int index)
index
- max 39
public void setVoltPointMSB(int index, int value)
index
- max 39value
- intpublic int getDistPointLSB(int index)
index
- max 39
public void setDistPointLSB(int index, int value)
index
- max 39value
- intpublic int getDistPointMSB(int index)
index
- max 39
public void setDistPointMSB(int index, int value)
index
- max 39.value
- intpublic float[] getRanges()
RangeFinder
getRanges
in interface RangeFinder
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |