Jump to content




Program


7 replies to this topic

#1 Rax

  • Members
  • 11 posts

Posted 30 March 2013 - 07:14 AM

Could someone help me get a 5 times pulser?

#2 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

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.

#3 Rax

  • Members
  • 11 posts

Posted 30 March 2013 - 07:21 AM

I meant like When redstone signal recieved pulse 5 times.

#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

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.

#5 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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


#6 Rax

  • Members
  • 11 posts

Posted 30 March 2013 - 07:39 AM

No, Something that, When redstone signal is recieved puts out 5 redstone pulses frm the back.

#7 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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


#8 Rax

  • Members
  • 11 posts

Posted 30 March 2013 - 07:48 AM

Thanks!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users