Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- set up monitor
- attachedMonitor = peripheral.wrap("top")
- attachedMonitor.setBackgroundColor(colors.black)
- attachedMonitor.setTextColor(colors.white)
- attachedMonitor.setTextScale(.5)
- attachedMonitor.clear()
- -- Display the button
- attachedMonitor.setBackgroundColor(colors.blue)
- attachedMonitor.setCursorPos(3,2)
- attachedMonitor.write(string.rep(" ",10)) -- 10 spaces
- --Display the label
- attachedMonitor.setTextColor (colors.white)
- attachedMonitor.setCursorPos(3+2,2) -- remember 2 columns more for centering here
- attachedMonitor.write("Button")
- -- reset to original text/background colors
- attachedMonitor.setBackgroundColor(colors.black)
- attachedMonitor.setTextColor(colors.white)
- -- sleep and then let's do it again with our "pressed" colors.
- sleep(3)
- attachedMonitor.setBackgroundColor(colors.red)
- attachedMonitor.setCursorPos(3,2)
- attachedMonitor.write(string.rep(" ",10))
- attachedMonitor.setTextColor(colors.yellow)
- attachedMonitor.setCursorPos(5,2)
- attachedMonitor.write("Button")
- -- reset to original text/background colors
- attachedMonitor.setBackgroundColor(colors.black)
- attachedMonitor.setTextColor(colors.white)
- -- indicate done
- attachedMonitor.setCursorPos(1,5)
- AttachedMonitor.write("Done.")
Add Comment
Please, Sign In to add comment