SoundSensorTest.java
import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.SensorPort;
import lejos.nxt.SoundSensor;
 
public class SoundSensorTest {
 
    public static void main(String [] args)  
               throws Exception 
               {
 
                  SoundSensor ss = new SoundSensor(SensorPort.S1, false);
 
                  LCD.drawString("Volume ", 0, 0);
 
                   while (! Button.ESCAPE.isPressed())
                   {
 
                       LCD.drawInt(SensorPort.S1.readRawValue(),3,13,0);
 
                       Thread.sleep(300);
                   }
                   LCD.clear();
                   LCD.drawString("Program stopped", 0, 0);
                   Thread.sleep(2000);
               }
 
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License