Jump to content




rs.output 2 ways


  • You cannot reply to this topic
2 replies to this topic

#1 Xixili

  • Members
  • 65 posts
  • LocationChina

Posted 21 April 2014 - 05:06 PM

Hello everyone.

Is it possible to have a redstone output on 2 sides the same moment?

For example the code below.
When the reactor turns online it sends a signal up (to turn on the reactor)
But I also want a output on the bottom the same moment.

I wonder if thats possible.

rednet.open("bottom") -- set rednet side
console = 314 -- enter ID of computer attached to the touch screen
nir = 313 -- enter ID of computer attached to the Nuclear information reader
maxTemp = 5000
temp = 1000
rctrStatus = "off"

while true do
  a,b = rednet.receive()
    if a == console then
	  if b == "on" then
	    rs.setOutput("top", true)
	    rctrStatus = "on"
	    break
	  elseif b == "off" then
	    break
	  end
    end
end		   

while true do
  if temp >= maxTemp then
    rs.setOutput("top", false)
--  elseif temp >= 7500 then
--    rs.setOutput("back" ,false)
  end
  a,b = rednet.receive()
  if a == nir then
    temp = tonumber(B)/>
  elseif a == console then
    if b == "maxTemp" then
	  rednet.send(console, "ping")
	  id, message = rednet.receive()
	  message = tonumber(message)
	  --if message < 7500 and
	    if id == console then
	    maxTemp = message
	    rednet.send(console, "true")
	  else
	    rednet.send(console, "false")
	  end
    elseif b == "on" then
	  if temp < maxTemp then
	    rs.setOutput("top", true)
	    rednet.send(console, "true")
	    rctrStatus = "on"
	    print("On received")
	  else
	    rednet.send(console, "false")
	  end
    elseif b == "off" then
	  rs.setOutput("top", false)
	  rednet.send(console, "true")
	  rctrStatus ="Off"
    end
  end
end


#2 CometWolf

  • Members
  • 1,283 posts

Posted 21 April 2014 - 05:24 PM

The code on the computer performs much much much faster than mc's tick-rate, which is what redstone runs on, meaning that just calling 2 rs.setOutputs in a row will result in 2 simoultaneous signals.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 21 April 2014 - 11:26 PM

Well... low as it is, there's still a chance they won't turn on within the same tick.

I assume it doesn't matter if it's not "instant" 100% of the time, but why not use one output and connect it to your multiple inputs?





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users