Big Reactors control
#1
Posted 10 July 2014 - 05:49 PM
My setup is an Energy Cell, which outputs an analog signal to a Comparator and then fed into a Computer, which is connected to the Computer Port on the Reactor. My code is here: http://pastebin.com/HpAMHCL7
My goal is when the comparator level drops below 2, the reactor will turn on, and once the comparator level reaches above 14, it will shut off the reactor. In my code, it just hangs at "Reactor connected, starting program"
I'm clueless why it hangs, and even when inputting my own analog signal with another Computer, it does nothing.
#2
Posted 10 July 2014 - 08:02 PM
EDIT:
Just making sure, the redstone input is at the left side, right?
Edited by flaghacker, 10 July 2014 - 08:03 PM.
#3
Posted 10 July 2014 - 08:09 PM
#4
Posted 10 July 2014 - 09:05 PM
#5
Posted 10 July 2014 - 09:09 PM
#6
Posted 10 July 2014 - 11:03 PM
#7
Posted 11 July 2014 - 06:48 PM
Heres the new code: http://pastebin.com/zrTH0TXQ
#8
Posted 11 July 2014 - 07:05 PM
Something like this may work better:
local reactor = peripheral.wrap("back")
if reactor.getConnected() then
print("Reactor connected, starting program")
while true do
local event = {os.pullEvent()}
if event[1]=="redstone" then
print("EVENT!")
if rs.getAnalogInput("left") <2 then
print("Power level low, starting reactor")
reactor.setActive(true)
sleep(1)
elseif rs.getAnalogInput("left") >14 then
print("Power level sufficient, reactor idling")
reactor.setActive(false)
sleep(1)
end
end
end
end
What this does is look for the specific redstone event. Compares the signal, then begins listening for the event again.
Edited by Kizz, 11 July 2014 - 07:08 PM.
#9
Posted 11 July 2014 - 07:25 PM
#10
Posted 11 July 2014 - 07:28 PM
#11
Posted 11 July 2014 - 09:16 PM
#12
Posted 11 July 2014 - 10:38 PM
Edited by Livewire13, 11 July 2014 - 10:48 PM.
#13
Posted 13 July 2014 - 04:12 PM
#14
Posted 13 July 2014 - 06:17 PM
local reactor = peripheral.wrap("back")
if reactor.getConnected() then
print("Reactor connected, starting program")
else
error( "Reactor unresponsive", 0 )
end
while true do
local event = {os.pullEvent()}
if event[1]=="redstone" then
print( "redstone detected" )
print( "signal strength: "..rs.getAnalogInput( "left" ) )
end
end
#15
Posted 13 July 2014 - 06:42 PM
So far if the power level is neither below 2 or above 13 (I changed it to 13 because I found that 14 = full power) it prints "redstone detected"
"signal strength: 7"
or whatever the strength is at the time.
Now I wait for the energy cell to drain down to 1 and see if it works.
#16
Posted 13 July 2014 - 07:15 PM
#17
Posted 13 July 2014 - 07:33 PM
#18
Posted 13 July 2014 - 09:55 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











