Advertisement
KingKevin23

farm_controller

Mar 8th, 2022
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local my_name = "farm"
  2. local modem_pos = "left"
  3. local protocol = "farm_control"
  4. local redstone_pos = "top"
  5.  
  6. redstone.setAnalogOutput(redstone_pos, 0)
  7. rednet.open(modem_pos)
  8. rednet.host(protocol, my_name)
  9. while true do
  10.     local id, message = rednet.receive(protocol)
  11.     if message == "off" then
  12.         redstone.setAnalogOutput(redstone_pos, 15)
  13.         print("Farm shut down by " .. id)
  14.     elseif message == "on" then
  15.         redstone.setAnalogOutput(redstone_pos, 0)
  16.         print("Farm started by " .. id)
  17.     else
  18.         print("Message was not recognized " .. message .. " " .. id)
  19.     end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement