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

Using redstone signal to start program

Started by agentmoo12, 04 September 2013 - 12:54 AM
agentmoo12 #1
Posted 04 September 2013 - 02:54 AM
Topic: How Do I Have a turtle check for a redstone signal to execute a program I wrote?


that's it :)/> Thanks! -Agentmoo12
Lyqyd #2
Posted 04 September 2013 - 12:50 PM
Split into new topic.
OmegaVest #3
Posted 04 September 2013 - 01:24 PM
The easiest way would be to include a massive while loop with an event pull that would look for redstone only, then fire the rest of the program.
ie

while true do
  evt, arg1 = os.pullEvent("redstone")
  if rs.getInput(side) then
    -- Program
  end
end

However, I get the sense that you also want this turtle to run other functions as well. Unfortunately, that is not so simple. And the above only works for up to six functions at a time (supposing no peripherals). But, this should give you a starting place, at least.
H4X0RZ #4
Posted 04 September 2013 - 04:33 PM
The easiest way would be to include a massive while loop with an event pull that would look for redstone only, then fire the rest of the program.
ie

while true do
  evt, arg1 = os.pullEvent("redstone")
  if rs.getInput(side) then
    -- Program
  end
end

However, I get the sense that you also want this turtle to run other functions as well. Unfortunately, that is not so simple. And the above only works for up to six functions at a time (supposing no peripherals). But, this should give you a starting place, at least.
You haven't defined "side".