Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- capacitors = peripheral.wrap("right") --Capacitor Side
- rednet.open("left") --modem side
- --Change number below to total capacitors in the multiblock below the computer
- local totalCapacitors = 9
- --Change side below to input for redstone signal from Power Monitor
- local powerMonitorInput = "back"
- local table = {}
- table.monitor = rs.getInput(powerMonitorInput)
- table.currPower = capacitors.getEnergyStored() * totalCapacitors
- table.maxPower = capacitors.getMaxEnergyStored() * totalCapacitors
- local lastPower = table.currPower
- table.powerChange = table.currPower - lastPower
- table.powerDelta = math.ceil(table.powerChange/10)
- local loop = 0
- rednet.broadcast(textutils.serialize(table))
- print(textutils.serialize(table))
- os.startTimer(.5)
- while true do
- event = os.pullEvent()
- if event == "timer" then
- os.startTimer(.5)
- table.currPower = capacitors.getEnergyStored() * totalCapacitors
- table.monitor = rs.getInput(powerMonitorInput)
- table.powerChange = table.currPower - lastPower
- table.powerDelta = math.ceil(table.powerChange/10)
- lastPower = table.currPower
- rednet.broadcast(textutils.serialize(table))
- loop = loop + 1
- if loop == 10 then --print table to screen evert 5 seconds
- print(textutils.serialize(table))
- loop = 0
- end
- end
- end
Add Comment
Please, Sign In to add comment