Monitor Test
local monitor = peripheral.wrap("top")
local n = 0
while true do
local w, h = monitor.getSize()
monitor.clear()
monitor.setCursorPos(1, h)
monitor.blit("-", "0", "e")
monitor.setCursorPos(w, h)
monitor.blit("+", "0", "d")
monitor.setCursorPos(1, 1)
monitor.write("COUNTER")
monitor.setCursorPos(1, 2)
monitor.write(("%.0f"):format(n))
local event, side, xPos, yPos = os.pullEvent("monitor_touch")
if xPos == 1 and yPos == h then
n = n - 1
elseif xPos == w and yPos == h then
n = n + 1
end
end
Comments