mjmac85

Untitled

Nov 27th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. -- set up monitor
  2. attachedMonitor = peripheral.wrap("right")
  3. attachedMonitor.setBackgroundColor(colors.black)
  4. attachedMonitor.setTextColor(colors.white)
  5. attachedMonitor.setTextScale(.5)
  6. attachedMonitor.clear()
  7.  
  8. -- Display the button
  9. attachedMonitor.setBackgroundColor(colors.blue)
  10. attachedMonitor.setCursorPos(3,2)
  11. attachedMonitor.write(string.rep(" ",10)) -- 10 spaces
  12. attachedMonitor.setCursorPos(3,3)
  13. attachedMonitor.write(string.rep(" ",10)) -- 10 spaces
  14. attachedMonitor.setCursorPos(3,4)
  15. attachedMonitor.write(string.rep(" ",10)) -- 10 spaces
  16. attachedMonitor.setCursorPos(3,5)
  17. attachedMonitor.write(string.rep(" ",10)) -- 10 spaces
  18.  
  19.  
  20. --Display the label
  21. attachedMonitor.setTextColor (colors.white)
  22. attachedMonitor.setCursorPos(3+2,2) -- remember 2 columns more for centering here
  23. attachedMonitor.write("Button")
  24.  
  25. -- reset to original text/background colors
  26. attachedMonitor.setBackgroundColor(colors.black)  
  27. attachedMonitor.setTextColor(colors.white)
  28.  
  29. -- sleep and then let's do it again with our "pressed" colors.
  30. sleep(3)
  31.  
  32. --attachedMonitor.setBackgroundColor(colors.red)
  33. --attachedMonitor.setCursorPos(3,2)
  34. --attachedMonitor.write(string.rep(" ",10))
  35. --attachedMonitor.setTextColor(colors.yellow)
  36. --attachedMonitor.setCursorPos(5,2)
  37. --attachedMonitor.write("Button")
  38.  
  39. -- reset to original text/background colors
  40. attachedMonitor.setBackgroundColor(colors.black)
  41. attachedMonitor.setTextColor(colors.white)
  42.  
  43. -- indicate done
  44. attachedMonitor.setCursorPos(1,5)      
  45. attachedMonitor.write("Done.")
Advertisement
Add Comment
Please, Sign In to add comment