Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Wrap the modem and monitor
- local mon = peripheral.wrap("top")
- local wmod = peripheral.wrap("back")
- -- Open different channels for different liquids
- wmod.open(3) --For water tank
- wmod.open(4) --For lava tank
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("Liquid status:")
- -- Main loop, never stop
- while true do
- -- Check for incoming data on any open channel
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- -- Add one case for every liquid
- -- Change channel and text for each
- if senderChannel == 3 then
- mon.setCursorPos(1,2)
- mon.write(message .." ")
- print(message .." from Water tank,")
- elseif senderChannel == 4 then
- mon.setCursorPos(1,3)
- mon.write(message .." ")
- print(message .." from Lava tank.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment