Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Big Reactor control program
- --Program by Archmon1 for computerCraft1.6
- --Cell should be placed like 2 blocks to the left
- --of the computer. Then a comparitor from vanilla
- --in between the thermal expantion cell and the
- --computerCraft computer but this is configurable
- --Just by changeing the cellRedstone var below.
- --The redstone to start the reactor is by default
- --set to top but this can be configured by
- --changing reactorRedstone below. I had to use a
- --block of cobble in order to relay the signal
- --to the reactor.
- --This program could very well be used to control
- --a set of generators or dynamos with out
- --much modifcation.
- --Enjoy.
- ---------------------------
- --var declare/inital set
- ---------------------------
- var = reactor
- reactor ="false"
- var = reactorRedstone
- reactorRedstone = "top"
- rs.setOutput(reactorRedstone, false)
- var = cellRedstone
- cellRedstone = "left"
- var = sleepvar
- sleepvar = 10
- ---------------------------
- --Functions
- ---------------------------
- function signal()
- rsStrength = rs.getAnalogInput(cellRedstone)
- -- print("redstone strength = ", rsStrength) --Test Line
- end
- ---------------------------
- --Program Start
- ---------------------------
- print("Program Start")
- print("Starting redstone level ", rs.getAnalogInput(cellRedstone))
- if rs.getAnalogInput(cellRedstone) < 15 then
- print ("redstone on") --prints only if cell not full
- end
- ---------------------------
- --Main Loop start
- ---------------------------
- while true do
- signal() --Function
- if rsStrength >= 15 then --Activates when cell full
- print("Cell Full, waiting for cell to drain")
- reactor="false" --sets var for while loop ahead
- rs.setOutput(reactorRedstone, false) --turns off reactor
- --While forces if loop to wait till power drops
- while reactor ~= "true" do
- if rsStrength <= 3 then
- reactor="true" --Breaks While loop inside if loop
- print("Power needed, reactor starting")
- -- print("redstone strength = ", rsStrength) --Test line
- else --Runs until power is low
- signal() --Function
- -- print("Waiting for need of power") --Test Line
- -- print("Redstone currently ", rsStrength) --Test Line
- sleep(sleepvar)
- end
- end
- end
- if rsStrength < 15 then --Still inside while true do
- -- print("redstone on") --testing line
- rs.setOutput(reactorRedstone, true)--Turns reactor on, but no message spam
- end
- sleep(sleepvar)
- end
- ------------------------
- --end program
- ------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement