Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.wrap("top")
- mod = peripheral.wrap("left")
- isOn = false
- local function drawGreen()
- for i = 0, 20 do
- for j = 0, 20 do
- m.setBackgroundColor(colors.lime)
- m.setCursorPos(i,j)
- m.write(" ")
- end
- local function drawRed()
- for i = 0, 20 do
- for j = 0, 20 do
- m.setBackgroundColor(colors.red)
- m.setCursorPos(i,j)
- m.write(" ")
- end
- local function touch()
- local event side, xpos, ypos = os.pullEvent("monitor_touch")
- if isOn then
- drawRed()
- rednet.open("left")
- rednet.broadcast("off")
- rednet.close("left")
- else
- drawGreen()
- rednet.open("left")
- rednet.broadcast("on")
- rednet.close("left")
- end
- end
- while true do
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement