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

Bundled Cable Pulsing Help

Started by Scios, 28 January 2012 - 08:58 PM
Scios #1
Posted 28 January 2012 - 09:58 PM
Hi. I was playing around with computer craft and red power 2 and I was wondering how to write a program to do alternating pulses. For example, on for seven minutes off for 3 seconds, and have that seven minute on to three seconds off repeat until I tell it to stop. Thanks for the help.
Casper7526 #2
Posted 29 January 2012 - 02:17 AM

timer = os.startTimer(420)
ison = true
while true do
if ison == true then
turnredstone on here
else
turnredstone off here
end
event, param = os.pullEvent()
if event == "timer" and param == timer then
if ison == true then ison = false timer = os.startTimer(3) else ison = true timer = os.startTimer(420) end
end
end

I literally typed this off the top of my head, but try it out.