This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
pendragon36's profile picture

[1.4] Add a command for a pulse of redstone power.

Started by pendragon36, 13 May 2012 - 02:23 AM
pendragon36 #1
Posted 13 May 2012 - 04:23 AM
I think there should be a command for a short pulse of on and off of redstone power, both normal power and Redpower power.
libraryaddict #2
Posted 13 May 2012 - 10:27 AM
You can accomplish this with a API..
There is also a program for this.

All they would be adding is a API you could easily do yourself.

Look up "redpulse"
Xfel #3
Posted 13 May 2012 - 10:32 AM
well, for normal redstone you could just say

redstone.setOutput(side,true)
os.sleep(1) -- sleep one second
redstone.setOutput(side,false)
Redpower can work with pulses of one tick length, that is getting a bit difficult, as you can't sleep that precise. But you can also pass values <1 to sleep().
Luanub #4
Posted 13 May 2012 - 08:16 PM
I've got redpower machines to work with sleeps as low as 0.1, which is faster then the redpower timer
ComputerCraftFan11 #5
Posted 13 May 2012 - 11:02 PM
well, for normal redstone you could just say

redstone.setOutput(side,true)
os.sleep(1) -- sleep one second
redstone.setOutput(side,false)
Redpower can work with pulses of one tick length, that is getting a bit difficult, as you can't sleep that precise. But you can also pass values <1 to sleep().

Or make it a API

function pulse( _nSide,  _nTime )
  redstone.setOutput( _nSide, true)
  sleep(_nTime)
  redstone.setOutput( _nSide, false)
end

pulse("back", 1) -- pulse for 1 second on the back of the pc
MysticT #6
Posted 13 May 2012 - 11:13 PM
well, for normal redstone you could just say

redstone.setOutput(side,true)
os.sleep(1) -- sleep one second
redstone.setOutput(side,false)
Redpower can work with pulses of one tick length, that is getting a bit difficult, as you can't sleep that precise. But you can also pass values <1 to sleep().

Or make it a API

function rs.pulse( _nSide,  _nTime )
  redstone.setOutput( _nSide, true)
  sleep(_nTime)
  redstone.setOutput( _nSide, false)
end

pulse("back", 1) -- pulse for 1 second on the back of the pc
Try to run it. It would say: "Attempt to write to global". Create a new API if you want, but with a new name (remove the rs. from the function name), and load it with os.loadAPI.
ComputerCraftFan11 #7
Posted 13 May 2012 - 11:16 PM
well, for normal redstone you could just say

redstone.setOutput(side,true)
os.sleep(1) -- sleep one second
redstone.setOutput(side,false)
Redpower can work with pulses of one tick length, that is getting a bit difficult, as you can't sleep that precise. But you can also pass values <1 to sleep().

Or make it a API

function rs.pulse( _nSide,  _nTime )
  redstone.setOutput( _nSide, true)
  sleep(_nTime)
  redstone.setOutput( _nSide, false)
end

pulse("back", 1) -- pulse for 1 second on the back of the pc
Try to run it. It would say: "Attempt to write to global". Create a new API if you want, but with a new name (remove the rs. from the function name), and load it with os.loadAPI.

Oops, updated the post.