pxt-ev3/docs/coding/reverse-beeper-3.md
Peli de Halleux 892a2d585f
Thresholds (#222)
* add threshold blocks

* updated strings

* added gap

* reorg color/gyro blocks

* fixing sound names

* adding stop block

* fixing exanmples
2018-01-09 12:46:48 -08:00

21 lines
477 B
Markdown

# Reverse Beeper Activity 2
```blocks
let beep = false
beep = true
control.runInBackground(function () {
motors.largeBC.setSpeed(-20)
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
motors.largeBC.stop()
beep = false
})
control.runInBackground(function () {
while (beep) {
if (sensors.ultrasonic4.distance() < 20) {
music.playTone(440, sensors.ultrasonic4.distance())
loops.pause(50)
}
}
})
```