-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample.ts
More file actions
35 lines (35 loc) · 741 Bytes
/
example.ts
File metadata and controls
35 lines (35 loc) · 741 Bytes
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
radio.onReceivedValueDeprecated(function (name, value) {
if (name == "A") {
arm = value
}
if (name == "R") {
roll = value
}
if (name == "T") {
throttle = value
}
})
let throttle = 0
let roll = 0
let arm = 0
let radioGroup = 7
radio.setGroup(radioGroup)
basic.showNumber(radioGroup)
if (arm) {
while (arm) {
basic.showIcon(IconNames.No)
}
basic.showIcon(IconNames.Yes)
}
basic.forever(function () {
basic.showNumber(Math.round(throttle / 10))
})
basic.forever(function () {
if (arm) {
hoverbit.start_cushion_simple()
hoverbit.forward_power_simple(throttle)
} else {
hoverbit.stop_all_motors()
}
hoverbit.direction_simple(roll)
})