Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("right")
- rednet.open("top")
- --setup
- mon.setTextScale(1)
- --pre start
- mon.setBackgroundColor(colors.black)
- mon.clear()
- function off_text(c,r)
- mon.setCursorPos(c,r)
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.red)
- mon.write("Off")
- end
- function on_text(c,r)
- mon.setCursorPos(c,r)
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.lime)
- mon.write("On ")
- end
- -- Button 1
- while true do
- off_text(2,2)
- event, side, x, y = os.pullEvent("monitor_touch")
- if x + 1 > 2 and x < 5 and y == 2 then
- on_text(2,2)
- if os.pullEvent("monitor_touch") then
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement