Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("api/ButtonAPI.lua")
- m = peripheral.find("monitor")
- txt = "On"
- tx2 = "Off"
- textcolor = colors.white
- textbgcolor = colors.lime
- term.clear()
- function func1(text)
- print("On")
- end
- function func2(text)
- print("Off")
- end
- function Draw()
- ButtonAPI.New(math.floor(w/2), 1, txt, func1, m, textcolor, textbgcolor)
- ButtonAPI.New(math.floor(w/2), 2, tx2, func2, m, textcolor, textbgcolor)
- end
- if m then
- m.clear()
- term.setCursorPos(1, 1)
- print("Running Touch")
- w,h = m.getSize()
- while true do
- Draw()
- end
- else
- term.clear()
- term.setCursorPos(1,1)
- print("No Monitors Found!")
- end
Add Comment
Please, Sign In to add comment