-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
56 lines (55 loc) · 1.24 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
input.onButtonPressed(Button.AB, function () {
radio.sendNumber(2)
})
input.onButtonPressed(Button.B, function () {
radio.sendNumber(3)
})
radio.onReceivedValue(function (name, value) {
MoistureValuePercent = parseFloat(name)
if (value == 1) {
basic.showString(name)
led.plotBarGraph(
MoistureValuePercent,
100
)
basic.pause(750)
basic.clearScreen()
}
if (value == 2) {
MotorOffOn_State = 1
basic.showString(name)
}
if (value == 21) {
MotorOffOn_State = 1
basic.showString(name)
}
if (value == 22) {
MotorOffOn_State = 1
led.plotBarGraph(
MoistureValuePercent,
100
)
}
if (value == 3) {
MotorOffOn_State = 0
basic.showString(name)
}
if (value == 31) {
MotorOffOn_State = 0
basic.showString(name)
}
})
let MoistureValuePercent = 0
let MotorOffOn_State = 0
basic.showIcon(IconNames.Happy)
MotorOffOn_State = 0
MoistureValuePercent = 0
radio.setFrequencyBand(20)
radio.setTransmitPower(7)
radio.setGroup(1)
radio.setTransmitSerialNumber(false)
basic.forever(function () {
})