Derek1017

Lights

Feb 27th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. -- set up monitor
  2. attachedMonitor = peripheral.wrap("top")
  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.  
  13. --Display the label
  14. attachedMonitor.setTextColor (colors.white)
  15. attachedMonitor.setCursorPos(3+2,2) -- remember 2 columns more for centering here
  16. attachedMonitor.write("Button")
  17.  
  18. -- reset to original text/background colors
  19. attachedMonitor.setBackgroundColor(colors.black)  
  20. attachedMonitor.setTextColor(colors.white)
  21.  
  22. -- sleep and then let's do it again with our "pressed" colors.
  23. sleep(3)
  24.  
  25. attachedMonitor.setBackgroundColor(colors.red)
  26. attachedMonitor.setCursorPos(3,2)
  27. attachedMonitor.write(string.rep(" ",10))
  28. attachedMonitor.setTextColor(colors.yellow)
  29. attachedMonitor.setCursorPos(5,2)
  30. attachedMonitor.write("Button")
  31.  
  32. -- reset to original text/background colors
  33. attachedMonitor.setBackgroundColor(colors.black)
  34. attachedMonitor.setTextColor(colors.white)
  35.  
  36. -- indicate done
  37. attachedMonitor.setCursorPos(1,5)      
  38. AttachedMonitor.write("Done.")
Add Comment
Please, Sign In to add comment