Posted 30 March 2013 - 07:14 AM
Could someone help me get a 5 times pulser?
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.
for i=1, 5 do
repeat
os.pullEvent('redstone')
until rs.getInput('back')
end
print 'I have received five pulses from the back.'
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
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