MinoCraft72

P4 Main

Jan 2nd, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. side_m = "left"
  4. pionColor = "red"
  5. m.clear()
  6.  
  7. function fillTable()
  8.    button.setTable("*1*", col1, 5,9,2,4)
  9.    button.setTable("*2*", col2, 11,15,2,4)
  10.    button.setTable("*3*", col3, 17,21,2,4)
  11.    button.setTable("*4*", col4, 23,27,2,4)
  12.    button.setTable("*5*", col5, 29,33,2,4)
  13.    button.setTable("*6*", col6, 35,39,2,4)
  14.    button.setTable("*7*", col7, 41,45,2,4)
  15.    button.screen()
  16. end
  17.  
  18. function getClick()
  19.    event,side,x,y = os.pullEvent("monitor_touch")
  20.    button.checkxy(x,y)
  21. end
  22.  
  23. function col1()
  24.    button.flash("*1*")
  25.    peripheral.call(side_m,"transmit",2,0, pionColor)
  26.    print("col1")
  27. end
  28.  
  29. function col2()
  30.    button.flash("*2*")
  31.    peripheral.call(side_m,"transmit",3,0, pionColor)
  32.    print("col2")
  33. end
  34.  
  35. function col3()
  36.    button.flash("*3*")
  37.    peripheral.call(side_m,"transmit",4,0, pionColor)
  38.    print("col3")
  39. end
  40.  
  41. function col4()
  42.    button.flash("*4*")  
  43.    peripheral.call(side_m,"transmit",5,0, pionColor)
  44.    print("col4")
  45. end
  46.  
  47. function col5()
  48.    button.flash("*5*")
  49.    peripheral.call(side_m,"transmit",6,0, pionColor)
  50.    print("col5")
  51. end
  52.  
  53. function col6()
  54.    button.flash("*6*")
  55.    peripheral.call(side_m,"transmit",7,0, pionColor)
  56.    print("col6")
  57. end
  58.  
  59. function col7()
  60.    button.flash("*7*")
  61.    peripheral.call(side_m,"transmit",8,0, pionColor)
  62.    print("col7")
  63. end            
  64. fillTable()
  65. --button.heading("Demo Button Prog")
  66. --button.label(1,5,"Demo!")
  67.  
  68. while true do
  69.    getClick()
  70. end
Advertisement
Add Comment
Please, Sign In to add comment