Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Monitors power storage devices such as TE3 Energy cells and output redstone signals once energy storage drops below set limits.
- --Building guide(looking at the front of the devices):
- -- MM
- -- EC
- -- M: Monitor, E: Energy storage device, C: Computer
- -- Redstone signal for the engines will be output out the back of the computer.
- -- More details: http://forum.feed-the-beast.com/threads/rhns-1-6-monster-build-journal-and-guide-collection.42664/page-15#post-718973
- local monitor = peripheral.wrap("top")
- local cell = peripheral.wrap("left")
- local upper = 0.90 --Upper limit for computer to stop transmitting redstone signal. 0.90=90% full.
- local lower = 0.10 --Lower limit for computer to start transmitting redstone signal.
- redstone.setOutput("back", false) --Defaulting to off
- monitor.clear()
- monitor.setBackgroundColour((colours.grey))
- monitor.setCursorPos(1,4)
- monitor.write(" ON ")
- monitor.setBackgroundColour((colours.green))
- monitor.setCursorPos(5,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- while true do
- eNow = cell.getEnergyStored("left")
- eMax = cell.getMaxEnergyStored("left")
- fill = (eNow / eMax)
- monitor.setCursorPos(11,2)
- monitor.write("Storage:")
- monitor.setCursorPos(11,3)
- monitor.write(eNow)
- monitor.setCursorPos(11,4)
- monitor.write("Of:")
- monitor.setCursorPos(11,5)
- monitor.write(eMax)
- monitor.setCursorPos(1,2)
- monitor.write("Engines:")
- if fill > upper then
- --energylevel is over upper level, turning redstone signal off
- redstone.setOutput("back", false)
- monitor.setBackgroundColour((colours.grey))
- monitor.setCursorPos(1,4)
- monitor.write(" ON ")
- monitor.setBackgroundColour((colours.green))
- monitor.setCursorPos(5,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- elseif fill < lower then
- --energy level is below lower limit, turning redstone signal on
- redstone.setOutput("back", true)
- monitor.setBackgroundColour((colours.green))
- monitor.setCursorPos(1,4)
- monitor.write(" ON ")
- monitor.setBackgroundColour((colours.grey))
- monitor.setCursorPos(5,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- end
- sleep(1)
- end --while
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement