Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local my_name = "reactor"
- local modem_pos = "back"
- local protocol = "machine_control"
- local redstone_pos = "front"
- 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 == "on" then
- redstone.setAnalogOutput(redstone_pos, 15)
- print("Machine turned on by " .. id)
- elseif message == "off" then
- redstone.setAnalogOutput(redstone_pos, 0)
- print("Machine turned off by " .. id)
- else
- print("Message was not recognized " .. message .. " " .. id)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement