42 lines
1016 B
Lua
42 lines
1016 B
Lua
if event.type == "program" then
|
|
mem.state = "lag_remove"
|
|
|
|
interrupt(1)
|
|
end
|
|
|
|
if event.type == "interrupt" then
|
|
if mem.state == "lag_remove" then
|
|
mem.state = "grab"
|
|
port.b = false
|
|
port.a = false
|
|
port.c = false
|
|
interrupt(20)
|
|
elseif mem.state == "grab" then
|
|
local count = mem.count or 0
|
|
mem.count = count + 1
|
|
digiline_send("monhive", "Hives\nprocessed:\n"..tostring(mem.count).."\n\n\n\n")
|
|
mem.state = "grab_end"
|
|
port.a = true
|
|
port.b = true
|
|
interrupt(1)
|
|
elseif mem.state == "grab_end" then
|
|
mem.state = "put_hive"
|
|
port.a = false
|
|
port.b = false
|
|
interrupt(10)
|
|
elseif mem.state == "put_hive" then
|
|
mem.state = "put_hive_end"
|
|
port.a = false
|
|
port.c = true
|
|
interrupt(1)
|
|
elseif mem.state == "put_hive_end" then
|
|
mem.state = "lag_remove"
|
|
port.a = false
|
|
port.c = false
|
|
interrupt(100)
|
|
end
|
|
end
|
|
|
|
if event.type == "digiline" then
|
|
end
|