Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- local t = touchpoint.new()
- local modem = peripheral.wrap("back")
- local outsidedoor = false
- function queryStates()
- --outside door state
- modem.transmit(1, 2, "outsidedoor_state")
- local e, ms, sc, rc, msg, sd = os.pullEvent("modem_message")
- if msg == "true" then outsidedoor = true end
- end
- function page1()
- -- t:add("<", page1(), 0, 0, 4, 4, colors.lightGray, colors.lightGray)
- t:add(">", nil, 22, 1, 26, 4, colors.red, colors.lime)
- if outsidedoor then t:add("Outside Door", outsidedoor, 1, 6, 26, 8, colors.lime, colors.red)
- else t:add("Outside Door", outsidedoor, 1, 6, 26, 8, colors.red, colors.lime) end
- t:draw()
- end
- function outsidedoor()
- modem.transmit(1, 2, "outsidedoor")
- if outsidedoor then outsidedoor = false
- else outsidedoor = true end
- page1()
- end
- queryStates()
- page1()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t:toogleButton(p1)
- t:run2(p1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement