Jump to content




Using redstone signal to start program


3 replies to this topic

#1 agentmoo12

  • New Members
  • 1 posts

Posted 04 September 2013 - 01: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

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 September 2013 - 11:50 AM

Split into new topic.

#3 OmegaVest

  • Members
  • 436 posts

Posted 04 September 2013 - 12: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.

#4 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 04 September 2013 - 03:33 PM

View PostOmegaVest, on 04 September 2013 - 12:24 PM, said:

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".





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users