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