pxt-ev3/docs/coding/ignition-3.md

338 B

Ignition Activity 3

while (true) {
    if (sensors.ultrasonic4.distance() < 10 &&
        sensors.touch1.wasPressed() &&
        brick.buttonEnter.wasPressed()) {
        music.playSoundEffectUntilDone(sounds.mechanicalMotorStart)
        music.playSoundEffectUntilDone(sounds.mechanicalMotorIdle);
    }
    pause(1);
}