Advertisement
Techtronic

FanControlV1

Apr 3rd, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. -- Fan Control v1
  2. -- Requires Spawner Control v1
  3. rednet.open("back")
  4. local id, msg, prot
  5. local stat = rs.getOutput("top")
  6.  
  7. local tOutputs = {
  8. ["fansCheck"] = function()
  9.     rednet.send(id, stat)
  10. end,
  11. ["fansOn"] = function()
  12.     rs.setOutput("top", true)
  13.     stat = rs.getOutput("top")
  14.     rednet.send(id, stat)
  15. end,
  16. ["fansOff"] = function()
  17.     rs.setOutput("top", false)
  18.     stat = rs.getOutput("top")
  19.     rednet.send(id, stat)
  20. end
  21. }
  22.  
  23. while true do
  24.     id, msg, prot = rednet.receive()
  25.     stat = rs.getOutput("top")
  26.     if tOutputs[msg] ~= nil then
  27.         tOutputs[msg]()
  28.     end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement