Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("left")
- monitor = peripheral.wrap("back")
- modem.open(1)
- event, side, xpos, ypos = os.pullEvent("monitor_touch")
- if event == "monitor_touch" then
- modem.transmit(1, 1, "toggle")
- --print(event)
- end
- event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if message == "ON" then
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- --monitor.setTextScale(1)
- monX, monY = monitor.getSize()
- monitor.setCursorPos(1, 1)
- monitor.setBackgroundColor(colors.red)
- monitor.write(string.rep(" ", monX))
- monitor.setCursorPos(1, monY)
- monitor.write(string.rep(" ", monX))
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.red)
- --monitor.setBackgroundColor(colors.gray)
- --monitor.setTextScale(2)
- monitor.setCursorPos(monX/2-3, 3)
- monitor.write("Turn Off")
- end
- if message == "OFF" then
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- monX, monY = monitor.getSize()
- --monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.green)
- monitor.setCursorPos(1, 1)
- monitor.write(string.rep(" ", monX))
- monitor.setCursorPos(1, monY)
- monitor.write(string.rep(" ", monX))
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.green)
- --monitor.setBackgroundColor(colors.gray)
- --monitor.setTextScale(2)
- monitor.setCursorPos(monX/2-3, 3)
- monitor.write("Turn On")
- end
- sleep(0.1)
- shell.run("startup")
Add Comment
Please, Sign In to add comment