Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local net = peripheral.find("modem")
- local chan = 2000
- local nchan = 1999
- function supersosik()
- local event, modemSide, senderChannel, replyChannel, message, distance = os.pullEvent("modem_message")
- if message == "on" then
- rs.setAnalogOutput("bottom", 1)
- net.transmit(nchan, nchan, "Answer from station: \nStarted pumping")
- elseif message == "off" then
- rs.setAnalogOutput("bottom", 0)
- net.transmit(nchan, nchan, "Answer from station: \nStopped")
- else
- net.transmit(nchan, nchan, "Answer from oil station: \nUnknown command")
- end
- end
- while true do
- if net.isOpen(chan) then
- supersosik()
- else
- net.open(chan)
- supersosik()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement