Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local my_name = "farm"
- local modem_pos = "left"
- local protocol = "farm_control"
- local redstone_pos = "top"
- redstone.setAnalogOutput(redstone_pos, 0)
- rednet.open(modem_pos)
- rednet.host(protocol, my_name)
- while true do
- local id, message = rednet.receive(protocol)
- if message == "off" then
- redstone.setAnalogOutput(redstone_pos, 15)
- print("Farm shut down by " .. id)
- elseif message == "on" then
- redstone.setAnalogOutput(redstone_pos, 0)
- print("Farm started by " .. id)
- else
- print("Message was not recognized " .. message .. " " .. id)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement