public class UltrasonicSensor
extends java.lang.Object
Constructor and Description |
---|
UltrasonicSensor()
Creates an ultrasonic sensor instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addUltrasonicListener(UltrasonicListener ultrasonicListener)
Registers the given ultrasonic listener with default trigger level 20.
|
void |
addUltrasonicListener(UltrasonicListener ultrasonicListener,
int triggerLevel)
Registers the given ultrasonic listener for the given trigger level.
|
void |
eraseBeamArea()
Erases the beam area (if it is currently shown).
|
java.lang.String |
getDistance()
Performs a measurement and reports the result.
|
double |
getValue()
Performs a measurement and reports the result.
|
void |
setBeamAreaColor(java.awt.Color color)
Sets the color of the beam area (two sector border lines and axis).
|
void |
setMeshTriangleColor(java.awt.Color color)
Sets the color of the triangle mesh lines.
|
void |
setProximityCircleColor(java.awt.Color color)
Sets the color of the circle with center at sensor location and radius
equals to the current distance value.
|
void |
setTriggerLevel(double level)
Sets a new trigger level.
|
public UltrasonicSensor()
public double getValue()
public java.lang.String getDistance()
public void addUltrasonicListener(UltrasonicListener ultrasonicListener, int triggerLevel)
ultrasonicListener
- the UltrasonicListener to get registeredtriggerLevel
- the trigger level where the callback is triggeredpublic void addUltrasonicListener(UltrasonicListener ultrasonicListener)
ultrasonicListener
- the LightListener to get registered.public void setTriggerLevel(double level)
level
- the new levelpublic void setMeshTriangleColor(java.awt.Color color)
color
- the color of the meshpublic void setBeamAreaColor(java.awt.Color color)
color
- the color of the beam areapublic void eraseBeamArea()
public void setProximityCircleColor(java.awt.Color color)
color
- the color of the circle