Advertisement
Guest User

Untitled

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