update input blocks in docs and tests

This commit is contained in:
Amerlander
2020-02-20 04:01:37 +01:00
parent 38cf0ec0c6
commit c2cdcaa40f
62 changed files with 109 additions and 115 deletions

View File

@ -43,7 +43,7 @@ music.onEvent(MusicEvent.BackgroundMelodyResumed, () => {
music.onEvent(MusicEvent.BackgroundMelodyRepeated, () => {
serial.writeLine("background repeated")
})
input.onButtonPressed(Button.A, () => {
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
music.beginMelody(music.builtInMelody(Melodies.BaDing), MelodyOptions.Once)
})
music.setTempo(100)

View File

@ -17,7 +17,7 @@ This example send the frequency and duration over radio
and plays it on the remote @boardname@.
```typescript
input.onButtonPressed(Button.A, () => {
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
music.playTone(440, 120)
led.toggle(0, 0)
})
@ -26,7 +26,7 @@ radio.onReceivedNumber(function (receivedNumber) {
const duration = receivedNumber & 0xffff;
music.playTone(freq, duration);
})
input.onButtonPressed(Button.B, () => {
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
music.setPlayTone((frequency: number, duration: number) => {
radio.sendNumber((frequency << 16) | (duration & 0xffff));
})