public class NxtSoundSensor extends Part
Constructor and Description |
---|
NxtSoundSensor(SensorPort port)
Creates a sensor instance connected to the given port.
|
Modifier and Type | Method and Description |
---|---|
void |
addSoundListener(SoundListener listener)
Registers the given sound listener with default trigger level 50.
|
void |
addSoundListener(SoundListener listener,
int triggerLevel)
Registers the given sound listener for the given trigger level.
|
int |
getValue()
Polls the sensor.
|
void |
sampleReceived(int count) |
int |
setTriggerLevel(int triggerLevel)
Sets a new trigger level and returns the previous one.
|
public NxtSoundSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic void addSoundListener(SoundListener listener, int triggerLevel)
listener
- the SoundListener to registertriggerLevel
- the trigger level where the callback is triggeredpublic void addSoundListener(SoundListener listener)
listener
- the SoundListener to registerpublic int setTriggerLevel(int triggerLevel)
triggerLevel
- the new trigger levelpublic void sampleReceived(int count)
public int getValue()