jessvi created page: Lab3 authored by Jesper Kurtzmann Svith's avatar Jesper Kurtzmann Svith
......@@ -26,35 +26,34 @@
>
> We made a program similar to the SonicSensorTest called SoundSensorTest, but changed it to use the sound sensor and > get the readings using the readValue() method of the SoundSensor class.
>
```
public class SoundSensorTest
{
public static void main(String [] args)
throws Exception
{
SoundSensor SS = new SoundSensor(SensorPort.S1);
//Set to dB mode
SS.setDBA(false);
LCD.drawString("SoundSensor ", 0, 0);
LCD.drawString("SoundLvL(dB) ", 0, 2);
while (! Button.ESCAPE.isDown())
{
LCD.drawInt(SS.readValue(), 3, 13, 2);
Thread.sleep(300);
}
LCD.clear();
LCD.drawString("Program stopped", 0, 0);
Thread.sleep(2000);
}
}
```
>```
>public class SoundSensorTest
>{
>
> public static void main(String [] args)
> throws Exception
> {
> SoundSensor SS = new SoundSensor(SensorPort.S1);
>
> //Set to dB mode
> SS.setDBA(false);
>
> LCD.drawString("SoundSensor ", 0, 0);
> LCD.drawString("SoundLvL(dB) ", 0, 2);
>
> while (! Button.ESCAPE.isDown())
> {
> LCD.drawInt(SS.readValue(), 3, 13, 2);
>
> Thread.sleep(300);
> }
> LCD.clear();
> LCD.drawString("Program stopped", 0, 0);
> Thread.sleep(2000);
> }
>}
>
>```
>
>**Results**
>
......
......