https://s3-us-west-2.amazonaws.com/secure.notion-static.com/70f048d6-4955-419b-92de-d84b6b28527d/10-click-here.png

What you’ll learn:

In this last exercise, we’ll look at how to use an Advanced Computer and an Advanced Monitor to create a giant touchscreen.

mon = peripheral.wrap("top")
	local message1 = "Click here."
	local message2 = "Clicked!
	while true do
		mon.setBackgroundColor(colors.black)
		mon.clear()
		mon.setTextScale(4)
		mon.setCursorPos(4,4)
		mon.setTextColor(colors.green)
		mon.write(message1)
		event, side, x, y = os.pullEvent("monitor_touch")
		if x > 4 and x < 15 and y == 4 then
			mon.setBackgroundColor(colors.green)
			mon.clear()
			mon.setCursorPos(4,4)
			mon.setTextColor(colors.black)
			mon.write(message2)
			sleep(3)
		end
	end