This repository was archived by the owner on Dec 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathM460_LED_1.lua
More file actions
58 lines (53 loc) · 1.26 KB
/
Copy pathM460_LED_1.lua
File metadata and controls
58 lines (53 loc) · 1.26 KB
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
57
58
local count = 0
local RELAY_NUM1 = 0
local LOITER_MODE = 5
local ALTHOLD_MODE = 2
local RTL_MODE = 6
local AUTO_MODE = 3
local LAND_MODE = 9
function relay_on()
relay:on(RELAY_NUM1)
end
function relay_off()
relay:off(RELAY_NUM1)
end
function led()
if arming:is_armed() then
-- if armed different flash pattern with different flight modes
if vehicle:get_mode() == LOITER_MODE then
if count == 0 or count == 2 then
relay_off()
else
relay_on()
end
elseif vehicle:get_mode() == AUTO_MODE then
if count == 0 or count == 2 or count == 4 then
relay_off()
else
relay_on()
end
elseif vehicle:get_mode() == LAND_MODE or vehicle:get_mode() == RTL_MODE then
if count < 3 then
relay_off()
else
relay_on()
end
else
if count == 0 then
relay_off()
else
relay_on()
end
end
-- arm count
count = count + 1
if count > 9 then
count = 0
end
else
-- disarmed
relay_off()
end
return led, 200
end
return led, 10