Changes
Page history
jessvi created page: Lab3
authored
Mar 02, 2015
by
Jesper Kurtzmann Svith
Show whitespace changes
Inline
Side-by-side
Lab3.markdown
View page @
3eb9caed
...
...
@@ -194,31 +194,37 @@
> sound (see video).
>
>```
while (!Button.ESCAPE.isDown()) {
soundLevel = sound.readValue();
LCD.drawInt(soundLevel, 4, 10, 0);
dl.writeSample(soundLevel);
outerloop: if (soundLevel < 50) {
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
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
}
}
}
}
}
Thread.sleep(5);
}
```
> while (!Button.ESCAPE.isDown()) {
> soundLevel = sound.readValue();
>
> LCD.drawInt(soundLevel, 4, 10, 0);
> dl.writeSample(soundLevel);
>
> outerloop: if (soundLevel < 50) {
> 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
> 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
> }
> }
> }
> }
> }
> Thread.sleep(5);
> }
>```
>
> [](http://www.youtube.com/watch?v=UMSrPEmQrwE)
>
...
...
...
...