on Loud Sound

Run some code when the microphone hears a loud sound.

input.onLoudSound(function(){});

Parameters

  • handler: the code to run when a loud sound is heard.

Example

Flash the pixels when a loud sound is detected.

let pixels = light.createStrip()

input.onLoudSound(function() {
    pixels.setAll(0xff0000)
    pause(100)
    pixels.setAll(0x000000)
})

See also

sound level

microphone
light