Posted 11 September 2013 - 01:01 PM
So i'm trying to make my code change redstone.setOutput on or off depening if my tank is full or not.
When i start my program and my tank is full it will keep redstone off, but if i take some liquid out of my tank it still says it's full with 720000 inside it.
Not sure what i'm doing wrong so i hope someone can help me spot the problem. I'm new to computercraft. :)/>
So my code is there, but whenever my liquid gets below 720000 it doesn't turn on redstone signal, and if i stop the program and start it again it will fine actiave the redstone signal, but then when the tank is full it wont turn it off again :(/>
When i start my program and my tank is full it will keep redstone off, but if i take some liquid out of my tank it still says it's full with 720000 inside it.
Not sure what i'm doing wrong so i hope someone can help me spot the problem. I'm new to computercraft. :)/>
local valve = peripheral.wrap("left")
local tableInfo = valve.getTanks("unknown")
while true do
for k, v in pairs(tableInfo) do
for x, y in pairs(v) do
if x == "amount" then
if (y == 720000) then
redstone.setOutput("right", false)
elseif (y < 720000) then
redstone.setOutput("right", true)
end
end
end
end
os.sleep(10)
end
So my code is there, but whenever my liquid gets below 720000 it doesn't turn on redstone signal, and if i stop the program and start it again it will fine actiave the redstone signal, but then when the tank is full it wont turn it off again :(/>