robathome icon

AutoMiner - GPS startup

robathome | PRO | 10/25/25 05:53:57 PM UTC (Edited) | 0 ⭐ | 308 👁️ | Never ⏰ | []
text |

720 B

|

None

|

0 👍

/

0 👎

-- startup.lua — GPS beacon using the built-in 'gps host' program
-- EDIT COORDS FOR THIS NODE:
local X, Y, Z = -925, 105, -1096
 -- open wireless/Ender modem
local m = peripheral.find("modem", function(_,p) return p.isWireless() end)
assert(m, "no wireless modem")
rednet.open(peripheral.getName(m))
 term.clear(); term.setCursorPos(1,1)
print(("GPS beacon @ (%.1f, %.1f, %.1f)"):format(X,Y,Z))
print("Hosting via 'gps host'...")
 -- keep hosting; auto-restart if it exits
while true do
  local ok, err = pcall(function()
    shell.run("gps","host", tostring(X), tostring(Y), tostring(Z))
  end)
  if not ok then print("gps host error: "..tostring(err)) else print("gps host exited; restarting") end
  sleep(2)
end
 

Comments