Jump to content




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


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

#1 pendragon36

  • New Members
  • 1 posts

Posted 13 May 2012 - 03: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.

#2 libraryaddict

  • New Members
  • 195 posts

Posted 13 May 2012 - 09: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"

#3 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 13 May 2012 - 09: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().

#4 Luanub

    Lua Nub

  • Members
  • 1,135 posts
  • LocationPortland OR

Posted 13 May 2012 - 07:16 PM

I've got redpower machines to work with sleeps as low as 0.1, which is faster then the redpower timer

#5 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 13 May 2012 - 10:02 PM

View PostXfel, on 13 May 2012 - 09:32 AM, said:

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


#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 13 May 2012 - 10:13 PM

View PostComputerCraftFan11, on 13 May 2012 - 10:02 PM, said:

View PostXfel, on 13 May 2012 - 09:32 AM, said:

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.

#7 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 13 May 2012 - 10:16 PM

View PostMysticT, on 13 May 2012 - 10:13 PM, said:

View PostComputerCraftFan11, on 13 May 2012 - 10:02 PM, said:

View PostXfel, on 13 May 2012 - 09:32 AM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users