public class LegoSoundSensor extends SoundSensor implements Sensor
Modifier and Type | Field and Description |
---|---|
static int |
DB |
static int |
DBA |
static String |
NAME
String constant for type conversion
|
private SensorPort |
port |
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 and Description |
---|
LegoSoundSensor(SensorPort port) |
LegoSoundSensor(SensorPort port,
boolean dba) |
Modifier and Type | Method and Description |
---|---|
int |
getCommonValue()
Returns the most commonly used value of the sensor as an int (most sensors can return data as ints, if they can't, return -1, 255 or throw an UnsupportedOperationExceptiopn)
|
String |
getCommonValueAsString()
Returns the most commonly used value of the sensor as a string
Recommended Implementation:
return getCommonValue() + ""; |
ArrayList<String> |
getModes() |
String |
getName() |
SensorPort |
getPort() |
void |
setNewMode(int mode)
Sets the mode of the sensor
can be specific depending on the type of sensor (ie.
|
readValue, setDBA
public static final String NAME
UltrasonicSensor
,
Constant Field Valuespublic static final int DB
public static final int DBA
private SensorPort port
public LegoSoundSensor(SensorPort port, boolean dba)
public LegoSoundSensor(SensorPort port)
public String getCommonValueAsString()
Sensor
return getCommonValue() + "";
getCommonValueAsString
in interface Sensor
public int getCommonValue()
Sensor
getCommonValue
in interface Sensor
public void setNewMode(int mode)
Sensor
setNewMode
in interface Sensor
public SensorPort getPort()