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

Program

Started by Rax, 30 March 2013 - 06:14 AM
Rax #1
Posted 30 March 2013 - 07:14 AM
Could someone help me get a 5 times pulser?
Kingdaro #2
Posted 30 March 2013 - 07:20 AM
Just use the redpulse program.


redpulse (side) (count) (period)
Side is the side you want to pulse, count is how many times you want to pulse, and period is the time between each pulse in seconds.
Rax #3
Posted 30 March 2013 - 07:21 AM
I meant like When redstone signal recieved pulse 5 times.
Kingdaro #4
Posted 30 March 2013 - 07:37 AM
Hm.


for i=1, 5 do
  repeat
    os.pullEvent('redstone')
  until rs.getInput('back')
end

print 'I have received five pulses from the back.'

Something like this? The program says when it has received five pulses.
remiX #5
Posted 30 March 2013 - 07:39 AM
Each time a redstone signal is triggered on the side you want it, increment a variable.


local side = 'left'
local count = 0

while true do
	os.pullEvent( 'redstone' )
	if rs.getInput( side ) then
		if count == 5 then
			-- Count is now 5, so let's do something!
		end
		-- Ok so redstone signal on the left side is active, so let's increment the count variable
		count = count + 1
	end
end
Rax #6
Posted 30 March 2013 - 07:39 AM
No, Something that, When redstone signal is recieved puts out 5 redstone pulses frm the back.
remiX #7
Posted 30 March 2013 - 07:42 AM
Oh, so you want it that when a redstone signal is receive it must give out 5 pulses to the back?


while true do
    os.pullEvent( 'redstone' )
    -- Redstone signal received, yipee
    for i = 1, 5 do
        rs.setOutput( 'back', true )
        sleep( 0.25 )
        rs.setOutput( 'back', false )
        sleep( 0.25 )
    end
end
Rax #8
Posted 30 March 2013 - 07:48 AM
Thanks!