micro:bits Code

<div>
<div>radio.onDataPacketReceived( ({ receivedString: name, receivedNumber: value }) => {</div>
<div>serial.writeLine("received message!")</div>
<div>if (name == "danna" && value == 0) {</div>
<div>basic.showString("danna SOS!")</div>
<div>basic.showIcon(IconNames.Heart)</div>
<div>for (let i = 0; i < 3; i++) {</div>
<div>for (let i = 0; i < 3; i++) {</div>
<div>music.playTone(880, music.beat(BeatFraction.Quarter))</div>
<div>}</div>
<div>for (let i = 0; i < 3; i++) {</div>
<div>music.playTone(880, music.beat(BeatFraction.Half))</div>
<div>}</div>
<div>for (let i = 0; i < 3; i++) {</div>
<div>music.playTone(880, music.beat(BeatFraction.Quarter))</div>
<div>}</div>
<div>basic.pause(300)</div>
<div>}</div>
<div>basic.clearScreen()</div>
<div>}</div>
<div>})</div>
<div>input.onButtonPressed(Button.A, () => {</div>
<div>serial.writeLine("pushed button A!")</div>
<div>radio.sendValue("yome", 0)</div>
<div>basic.showString("send SOS!")</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>. . . . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>. . # . .</div>
<div>. . . . .</div>
<div>. . . . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div>. . . . .</div>
<div>. # . # .</div>
<div>. . # . .</div>
<div>. # . # .</div>
<div>. . . . .</div>
<div>`)</div>
<div>basic.showLeds(`</div>
<div># . # . #</div>
<div>. . . . .</div>
<div># . # . #</div>
<div>. . . . .</div>
<div># . # . #</div>
<div>`)</div>
<div>basic.pause(1000)</div>
<div>basic.clearScreen()</div>
<div>})</div>
<div>radio.setGroup(1)</div>
</div>

 

 

コメントを残す

メールアドレスが公開されることはありません。