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 Lava Tank
- wmod.open(4) --For Oil Tank
- wmod.open(5) --For Fuel Tank
- wmod.open(6) --For OtherTanks
- 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 Lava tank,")
- elseif senderChannel == 4 then
- mon.setCursorPos(1,3)
- mon.write(message .." ")
- print(message .." from Oil tank.")
- elseif senderChannel == 5 then
- mon.setCursorPos(1,4)
- mon.write(message .." ")
- print(message .." from Fuel tank,")
- elseif senderChannel == 6 then
- mon.setCursorPos(1,5)
- mon.write(message .." ")
- print(message .." from Other tanks,")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment