Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- storage = peripheral.wrap("right") -- Induction Matrix
- mon = peripheral.wrap("top") -- Monitor side
- mon.setTextScale(0.5) --Scale of text on monitor. 0.5-5
- total = 0 -- Variable for total usage
- if fs.exists("power") == true then -- Does the file exist?
- myFile = fs.open("power", "r") -- If it does, open the file in read mode
- total = myFile.readLine() -- set total to the amount already used
- myFile.close() -- close the file
- else
- myFile = fs.open("power", "w") -- if not, open the file in write mode
- myFile.writeLine("0") -- set the usage to 0
- myFile.close() -- close the file
- end
- while true do
- mon.clear() --Clears the monitor
- mon.setCursorPos(1,1) --Cursor set to 1,1
- mon.write(storage.getOutput()/2.5) --Writes the output to the monitor
- total = total + storage.getOutput()/2.5 * 20 -- Adds to the total amount of RF used
- mon.setCursorPos(1,2)
- mon.write("Used: ".. total)
- myFile = fs.open("power", "w") -- Opens the file for power used
- myFile.writeLine(total) -- Writes the total amount used.
- myFile.close() -- Closes file
- sleep(1) -- Sleeps for one second
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement