josh rain
Published © GPL3+

Too Loud and Don't Touch Me

This device is designed to scream if it is moved or if the environment is too loud.

BeginnerProtip1 hour102
Too Loud and Don't Touch Me

Story

Read more

Schematics

wire

Code

code for dont touch me

JavaScript
input.buttonA.onEvent(ButtonEvent.Click, function () {
    music.stopAllSounds()
})
forever(function () {
    light.graph(input.soundLevel(), 175)
    if (input.soundLevel() > 200 || input.acceleration(Dimension.X) > 0) {
        music.setVolume(256)
        while (input.soundLevel() > 135) {
            for (let i = 0; i < 4; i++) {
                music.playTone(988, music.beat(BeatFraction.Eighth))
                music.playTone(932, music.beat(BeatFraction.Eighth))
            }
        }
    }
})

Credits

josh rain

josh rain

2 projects • 0 followers

Comments