Morse01 lösung: Unterschied zwischen den Versionen

Aus microbit - Das Schulbuch
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „<pre id=01"> input.onButtonPressed(Button.A, function () { basic.showLeds(` . . . . . . . . . . . . . . . . . . . .…“)
 
Zeile 54: Zeile 54:
  
 
</pre>
 
</pre>
 +
 +
<htmlet>makecode_embed</htmlet>

Version vom 14. Oktober 2021, 01:47 Uhr

input.onButtonPressed(Button.A, function () {
    basic.showLeds(`
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        `)
    basic.showLeds(`
        . . . . .
        . . . . .
        . . # . .
        . . . . .
        . . . . .
        `)
    radio.sendString(".")
})
radio.onReceivedString(function (receivedString) {
    if (receivedString.includes(".")) {
        music.playTone(262, music.beat(BeatFraction.Whole))
        basic.showLeds(`
            . . . . .
            . . . . .
            . . # . .
            . . . . .
            . . . . .
            `)
    } else {
        music.playTone(262, music.beat(BeatFraction.Breve))
        basic.showString("-")
    }
})
input.onButtonPressed(Button.B, function () {
    basic.showLeds(`
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        . . . . .
        `)
    basic.showString("-")
    radio.sendString("-")
})
basic.showLeds(`
    . . # . .
    # # # # #
    . . # . .
    . # . # .
    # . . . #
    `)
radio.setGroup(25)