-
Notifications
You must be signed in to change notification settings - Fork 0
/
Draw-Robot-Remote-Control.ts
45 lines (44 loc) · 1.11 KB
/
Draw-Robot-Remote-Control.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
41
42
43
44
/**
* Custom blocks
*/
//% weight=100 color=#4a0087 icon=""
namespace drawRobotRemoteControle {
//% block="Set Microbit as RemoteController(radioGroup: $radioGroup )"
export function setAsRemoteController(radioGroup: number){
radio.setGroup(radioGroup)
input.onButtonPressed(Button.A, function () {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
radio.sendString("left")
})
input.onButtonPressed(Button.AB, function () {
basic.showIcon(IconNames.Yes)
radio.sendString("next")
})
input.onButtonPressed(Button.B, function () {
basic.showLeds(`
. . # . .
. . # # .
# # # # #
. . # # .
. . # . .
`)
radio.sendString("right")
})
input.onLogoEvent(TouchButtonEvent.Pressed, function () {
basic.showLeds(`
# . . . #
. # . # .
. . # . .
. # . # .
# . . . #
`)
radio.sendString("stop")
})
}
}