|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecticommand.nxt.I2CSensor
icommand.nxt.UltrasonicSensor
public class UltrasonicSensor
| Field Summary |
|---|
| Fields inherited from class icommand.nxt.I2CSensor |
|---|
DEFAULT_ADDRESS, PRODUCT_ID, SENSOR_TYPE, STOP, VERSION |
| Constructor Summary | |
|---|---|
UltrasonicSensor(SensorPort s)
Sets the sensor to LOWSPEED_9V and puts it into continuous measurement. |
|
| Method Summary | |
|---|---|
void |
calibrate(byte scaleFactor,
byte scaleDivisor,
byte zero)
If your sensor readings seem off, you can calibrate the sensor to make it different from factory settings. |
int |
getDistance()
Returns the distance to the closest object. |
byte[] |
getDistances()
The ultrasonic sensor is capable of sending a ping and recording up to 8 echoes. |
int |
getFactoryScaleDivisor()
Gets the default scale factor, which produces either cm's, inches, or some other unit. |
int |
getFactoryScaleFactor()
Gets the default scale factor, which produces either cm's, inches, or some other unit. |
int |
getFactoryZero()
Gets the default "zero" point, which is 0. |
int |
getMeasurementInterval()
The time interval between measurements in continuous mode. |
java.lang.String |
getMeasurementUnits()
Returns some sort of string that indicates measurement units. |
int |
getScaleFactor()
Gets the scale factor, which produces either cm's, inches, or some other unit. |
void |
setMeasurementInterval(byte interval)
|
void |
setMetric(boolean isMetric)
Determines if the sensor produces distances in cm or inches. |
void |
setScaleDivisor(byte divisor)
|
void |
setScaleFactor(byte scale)
Sets the scale factor, producing either cm's, inches, or some other unit. |
void |
setSensorMode(byte modeEnumeration)
Sets the state for the sensor. |
void |
setZero(byte zeroPoint)
|
| Methods inherited from class icommand.nxt.I2CSensor |
|---|
fetchString, getData, getData, getId, getProductID, getSensorType, getVersion, sendData, sendData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UltrasonicSensor(SensorPort s)
s - | Method Detail |
|---|
public void setSensorMode(byte modeEnumeration)
modeEnumeration - e.g. OFF, SINGLE_SHOT, CONTINUOUS_MEASUREMENT, EVENT_CAPTURE, REQUEST_WARM_RESETpublic int getDistance()
public void setMetric(boolean isMetric)
isMetric - true = cm's, false = inchespublic byte[] getDistances()
public int getMeasurementInterval()
public void setScaleFactor(byte scale)
scale - Can be a number 0 to 255 likely. Need to use short.public void setZero(byte zeroPoint)
public void setScaleDivisor(byte divisor)
public void calibrate(byte scaleFactor,
byte scaleDivisor,
byte zero)
scaleFactor - Raw reading is multiplied by this number. 1 = factory setting.scaleDivisor - Raw reading divides by this number. 14 = factory settingzero - e.g. If you find the real distance is 10 cm and the sensor says 12 cm you can adjust the zero. 0 = factory setting.public int getScaleFactor()
public int getFactoryScaleFactor()
public int getFactoryScaleDivisor()
public int getFactoryZero()
public void setMeasurementInterval(byte interval)
interval - !! Can be a number 0 to 255 likely. Need to use short.public java.lang.String getMeasurementUnits()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||