|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecticommand.platform.nxt.I2CSensor
icommand.platform.nxt.Ultrasonic
public class Ultrasonic
Constructor Summary | |
---|---|
Ultrasonic(Sensor 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.platform.nxt.I2CSensor |
---|
getId, getProductID, getSensorType, getVersion |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Ultrasonic(Sensor 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)
interval
- !! 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 |