---- Super Security Door, By Gustavo Wizard, @2014
---- This program needs Direwolf20 Button API
---- This program needs 2 monitors (bottom 1x1 and top 3x1) 
---- Plz give credit for me and for the button API author if using this program in any way


os.loadAPI("btn")
m = peripheral.wrap("bottom")

m.setTextScale(0.5)

while true do
m.setBackgroundColor(colors.black)
m.clear()
m.setCursorPos(5,1)
m.setTextColor(colors.cyan)
m.write("AIRLOCK")
term.redirect(m)
paintutils.drawLine(2,3,14,3,colors.magenta)
paintutils.drawLine(2,8,14,8,colors.magenta)
paintutils.drawLine(2,3,2,8,colors.magenta)
paintutils.drawLine(14,3,14,8,colors.magenta)
m.setBackgroundColor(colors.blue)
m.setTextColor(colors.white)

function fillTable()
 btn.setTable("OPEN", open, 4,12,5,6)
 btn.screen()
end

function getClick()
 event,side,x,y = os.pullEvent("monitor_touch")
 btn.checkxy(x,y)
end

function open()
 rs.setOutput("back", true)
 sleep(5)
 rs.setOutput("back", false)
end

fillTable()

getClick()

end

