Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- HobNet Host --
- -- Startup
- protocol = "HobNet";
- hostName = "Master";
- port = "right";
- waitTime = 10
- rednet.open("right");
- rednet.host(protocol, hostName);
- oilrigId = 0
- print("Loading...")
- function Oilrig()
- print("Oilrig:")
- command = rednet.receive(protocol) -- waitTime
- if(command == "Motor1 On") then
- print("Motor #1 is now: On")
- rednet.send(oilrigId, "Motor1 On", protocol)
- elseif(command == "Motor1 Off") then
- print("Motor #1 is now: Off")
- rednet.send(oilrigId, "Motor1 Off", protocol)
- end
- end
- function Shutdown()
- rednet.unhost(protocol, hostName)
- rednet.close(port)
- end
- print("Done entering main loop...")
- while true do
- print("Waiting for input...")
- input = rednet.receive(protocol)
- if(input[2] == "Oilrig") then
- Oilrig()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement