Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Power Monitoring Program Written By: 0_Mr_Redstone_0 AKA MoJoCreatior
- This code is considered free for use both commercial and private and can be redistributed so long as it meats following criteria:
- 1: 0_Mr_Redstone_0 and MoJoCreatior are credited as the original authors
- 2: You do not try to take full ownership of the code/written program
- 3: If you modify the code for re-upload you must provide it under the same conditions. as in- Open Source, and credited to me as original author]]
- --Setup instructions for terminal
- term.setTextColour(colors.red)
- print("Running Setup")
- term.setTextColour(colors.lightblue)
- print("What is the name of your Monitor?")
- mon = io.read()
- print("What is the name of your Energy Storage Device?")
- cube = io.read()
- print("What is the Title for your Info Board?")
- title = io.read()
- print("What is the Energy Unit?")
- unit = io.read()
- term.setTextColour(colors.red)
- print("Confirm Settings")
- term.setTextColour(colors.orange)
- print("Monitor: "..mon)
- print("Battery: "..cube)
- print("Title: "..title)
- print("Unit: "..unit)
- term.setTextColour(colors.red)
- print("Hold CTRL+R to redo settings")
- sleep(1)
- print("Saving Settings")
- print("Settings Saved")
- --Wraps the user input peripherals
- mon = peripheral.wrap(mon)
- cube = peripheral.wrap(cube)
- mon.setTextColour(colors.purple)
- mon.setTextScale(1)
- mon.setCursorPos(0,0)
- mon.setBackgroundColour(colors.lightBlue)
- mon.print(title)
- while true do
- --calculates percentages and information regarding the energy storage
- max = cube.getMaxEnergyStored()
- cur = cube.getEnergyStored()
- percentA = math.floor(cur/max)
- percentA = math.floor(percent * 100)
- percentB = math.floor(percentA + .05)
- bar = 100/28
- mon.setCursorPos(0,1)
- mon.setBackgroundColour(colors.white)
- mon.setTextColour(colors.orange)
- mon.clearLine()
- mon.print("Current Energy: "..cur..unit)
- mon.setCursorPos(0,3)
- mon.setTextColour(colors.green)
- mon.clearLine()
- mon.print(percent.."% Full")
- --Percent Filling Bar
- mon.setTextScale(.5)
- mon.setCursorPos(0,4)
- if 0==bar then
- mon.setTextColour(colors.lightGray)
- mon.setBackgroundColour(colors.lightGray)
- mon.print("0000000000000000000000000000")
- end
- if bar<=percentA<=bar*2 or percentA==bar*2 then
- mon.setCursorPos(0,4)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement