Guest User

program

a guest
May 2nd, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. local redstoneout = "back"
  2. local monitor = "top"
  3.  
  4. local mon = peripheral.wrap(monitor)
  5.  
  6. local redstone = 0
  7.  
  8. rs.setAnalogOutput(redstoneout, 0)
  9.  
  10. print("Program by Matrix89")
  11.  
  12. while true do
  13.  
  14. mon.setBackgroundColor(colors.blue)
  15.  
  16. mon.clear()
  17.  
  18. mon.setCursorPos(1,3)
  19.  
  20. mon.setBackgroundColor(colors.yellow)
  21.  
  22. mon.write("+")
  23.  
  24. mon.setCursorPos(7,3)
  25.  
  26. mon.write("-")
  27.  
  28. mon.setCursorPos(3,4)
  29.  
  30. mon.setBackgroundColor(colors.blue)
  31.  
  32. mon.write(redstone)
  33.  
  34. mon.setCursorPos(1,5)
  35.  
  36. mon.setBackgroundColor(colors.red)
  37.  
  38. mon.write("Set 0  ")
  39.  
  40. mon.setCursorPos(1,1)
  41.  
  42. mon.setBackgroundColor(colors.green)
  43.  
  44. mon.write("Set 15 ")
  45.  
  46. local event, side ,xPos ,yPos = os.pullEvent("monitor_touch")
  47. if yPos == 3 then
  48. if xPos == 1 then
  49. redstone = redstone + 1
  50. end
  51. if xPos == 7 then
  52. redstone = redstone - 1
  53. end
  54. end
  55. if yPos == 5 then
  56. redstone = 0
  57. end
  58. if yPos == 1 then
  59. redstone = 15
  60. end
  61. if redstone == -1 then
  62. redstone = 0
  63. end
  64. if redstone == 16 then
  65. redstone = 15
  66. end
  67. sleep(0.1)
  68. rs.setAnalogOutput(redstoneout, redstone)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment