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

How to make the output pulse

Started by Learning_inpaired, 27 December 2012 - 03:29 AM
Learning_inpaired #1
Posted 27 December 2012 - 04:29 AM
The title says it, i cant seem to figue out how to make my output pulse, at a diffrent rates based on user input. example: i select the number of item pulls to be 5 how do i make it pulse 5? at a rate of 0.8 sec delay between pulses? im useing butons as the user input not direct input by right clicking the computer, idk if that helps.
tekkit 3.1.2
remiX #2
Posted 27 December 2012 - 04:43 AM

print("How many pulses?")
pulses = tonumber(read())
print("Length of each pulse?")
length = tonumber(read())

for i = 1, pulses do
	rs.setOutput("back", true)
	sleep(length)
	rs.setOutput("back", false)
	sleep(length)
end
Learning_inpaired #3
Posted 27 December 2012 - 07:18 AM
can i do the pulse at a pre-set rate like this,
pulses = tonumber(read()
length = tonumber (0.8)
Lyqyd #4
Posted 27 December 2012 - 07:30 AM
Yep, though you don't need the second tonumber; length = 0.8 would work just fine.