---- 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("top")

m.setTextScale(0.5)

while true do
m.setBackgroundColor(colors.black)
m.clear()
m.setCursorPos(3,1)
m.setTextColor(colors.cyan)
m.write("Main Lasers")
term.redirect(m)
paintutils.drawLine(2,3,14,3,colors.red)
paintutils.drawLine(2,11,14,11,colors.red)
paintutils.drawLine(2,3,2,11,colors.red)
paintutils.drawLine(14,3,14,11,colors.red)
m.setBackgroundColor(colors.blue)
m.setTextColor(colors.white)

function fillTable()
 btn.setTable("1-Shot", o, 4,12,5,5)
 btn.setTable("A-Shot", a, 4,12,7,7)
 btn.setTable("Stop", s, 4,12,9,9)
 btn.screen()
end

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

function o()
btn.flash("1-Shot")
 rs.setOutput("left", true)
 sleep(.2)
 rs.setOutput("left", false)
end

function a()
btn.flash("A-Shot")
a=0
while a < 20 do

rs.setOutput("left", true)
sleep(.2)
rs.setOutput("left", false)
sleep(.2)
a = a+1
end
end

function s()
btn.flash("Stop")
rs.setOutput("right", false)
end

fillTable()

getClick()

end

