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

Redpulse

Started by geezuzraptr123, 03 September 2012 - 02:14 AM
geezuzraptr123 #1
Posted 03 September 2012 - 04:14 AM
Is there a way to make it go on forever?
KaoS #2
Posted 03 September 2012 - 05:10 AM
just write another program based on redpulse, here is a simple, modified version


local tArgs = { ... }
local sSide = tArgs[1]
if not sSide then
print("Usage: redpulse <side> <count> <period>")
return
end
local nCount = tonumber(tArgs[2]) or 1
local nPeriod = tonumber(tArgs[3]) or 0.5
if nCount==0 then
while true do
  redstone.setOutput(sSide,true)
  sleep(nPeriod/2)
  redstone.setOutput(sSide,false)
  sleep(nPeriod/2)
end
else
for n=1,nCount do
  redstone.setOutput( sSide, true )
  sleep( nPeriod / 2 )
  redstone.setOutput( sSide, false )
  sleep( nPeriod / 2 )
end
end

with this if you set the number of pulses to 0 it will keep looping indefinitely