jessvi created page: Lab3 authored by Jesper Kurtzmann Svith's avatar Jesper Kurtzmann Svith
...@@ -201,22 +201,16 @@ ...@@ -201,22 +201,16 @@
> dl.writeSample(soundLevel); > dl.writeSample(soundLevel);
> >
> outerloop: if (soundLevel < 50) { > outerloop: if (soundLevel < 50) {
> for (int i = 0; i < 24; i++) { // Sound must peak > for (int i = 0; i < 24; i++) { // Sound must peak within 25 ms.
> within 25 ms.
> Thread.sleep(1); > Thread.sleep(1);
> soundLevel = sound.readValue(); > soundLevel = sound.readValue();
> if (soundLevel > 85) { // New peak > if (soundLevel > 85) { // New peak in sound profile
> in sound profile > for (int y = 0; y < 250; y++) { // Sound must drop within 250 ms
> for (int y = 0; y < 250; y++) { // Sound must drop
> within 250 ms
> soundLevel = sound.readValue(); > soundLevel = sound.readValue();
> Thread.sleep(1); > Thread.sleep(1);
> if (soundLevel < 50) { // Sound has > if (soundLevel < 50) { // Sound has dropped
> dropped > Sound.twoBeeps(); //Beeps twice to indicate a clap
> Sound.twoBeeps(); // > break outerloop; //Return to the start of the loop
> Beeps twice to indicate a clap
> break outerloop; //
> Return to the start of the loop
> } > }
> } > }
> } > }
... ...
......