Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- mon = peripheral.wrap("back")
- local rubber = false
- local light = false
- while(true)do
- mon.setCursorPos(2,2)
- if (rubber) then
- mon.setBackgroundColor(colors.green)
- else
- mon.setBackgroundColor(colors.red)
- end
- mon.write("Rubber Farm")
- event, side, x, y = os.pullEvent("monitor_touch")
- print(x)
- print(y)
- if(x>2 and x<14 and y>1 and y<4)then
- rednet.send(13,"rubber")
- end
- rednet.send(13,"update")
- local rec = true
- rubber =false
- light = false
- while (rec) do
- local senderId, message, protocol = rednet.receive()
- if(message=="rubber")then
- rubber = true
- end
- if(message=="light")then
- light = true
- end
- if(message=="end")then
- rec = false
- end
- end
- if (rubber) then
- print("Rubber ist an")
- else
- print("Rubber ist aus")
- end
- if(light)then
- print("light ist an")
- else
- print("light ist aus")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement