Jump to content




How to send a pulse of redstone to flip the switch


3 replies to this topic

#1 dranasshinternal

  • New Members
  • 2 posts

Posted 19 October 2012 - 12:06 AM

I am using a computer to be able to turn on my forcefield and tesla coil killing field. Below is the programs i am using. What i need to do is have it send a pulse of redstone after it is turned off so it can flip the latch switch by the generators to the off posistion.

edit startup
print("type shield to power the shield or to power it off")
print("type tesla to turn on or off the tesla coils")

edit shield :
print("type on to power the shield") print("type off to power off shield")
text = read()
if text == "on" then redstone.setOutput("bottom", true) end
if text == "off" then redstone.setOutput("bottom", false) end

edit tesla :
print("type on to turn the tesla coils on") print("type off to turn the tesla coils off")
text = read()
if text == "on" then redstone.setOutput("top", true) end
if text == "off" then redstone.setOutput("top", false) end

#2 EmTeaKay

  • Members
  • 115 posts

Posted 19 October 2012 - 12:38 AM

Use this code:
shell.run("redpulse", "side", "time", "amount of pulses you want")
Or, another way to do this using a function is:
function rdpls(side, time, pulse)
 shell.run("redpulse", side, time, pulse)
end


#3 dranasshinternal

  • New Members
  • 2 posts

Posted 19 October 2012 - 01:46 AM

thanks, that worked like a charm, was bashing my head into the wall trying to get it to work.

#4 Doyle3694

  • Members
  • 805 posts

Posted 19 October 2012 - 08:00 AM

or you can do
function redpulse(side, time, times)
for i=1,times do
rs.setOutput(side, true)
sleep(time)
rs.setOutput(side, false)
sleep(time)
end
end
You know how arguements work in functions?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users