-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
40 lines (40 loc) · 1.29 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
input.onButtonPressed(Button.A, function () {
radio.sendString("yes")
basic.showIcon(IconNames.Yes)
basic.pause(500)
basic.clearScreen()
})
input.onButtonPressed(Button.AB, function () {
radio.sendString("come")
})
radio.onReceivedString(function (receivedString) {
if (receivedString == "yes") {
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.PowerUp), music.PlaybackMode.InBackground)
basic.showIcon(IconNames.Yes)
basic.pause(1000)
basic.clearScreen()
} else if (receivedString == "no") {
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.PowerDown), music.PlaybackMode.InBackground)
basic.showIcon(IconNames.No)
basic.pause(1000)
basic.clearScreen()
} else if (receivedString == "come") {
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.Baddy), music.PlaybackMode.InBackground)
basic.showLeds(`
. . # . .
. # # # .
# . # . #
. . # . .
. . # . .
`)
basic.pause(1000)
basic.clearScreen()
}
})
input.onButtonPressed(Button.B, function () {
radio.sendString("no")
basic.showIcon(IconNames.No)
basic.pause(500)
basic.clearScreen()
})
radio.setGroup(7)