Jump to content

Turtle redstone detection

1 reply to this topic

#1 henkekalmar

  • Members
  • 3 posts

Posted 05 March 2015 - 12:35 PM

Hello! I am trying to make a Magical Crops farm using turtles and Steve's Factory Manager.

So how I figured it would work is that SFM detects when the crops are fully grown and sends out a redstone signal to the turtle to start working, and here's where I'm stuck.
I use a code something among the lines of:
while true do
os.sleep(1) if rs.getInput("back")
then turtle.up()......
I had to put in a delay or it just messed up for me.

And that works fine for detecting a change in the redstone input but that also means that when the turtle does detect a redstone input he will go up, and when he does he will notice the redstone signal broke and he will go up once more.
Basically the turtle will go up once and then forward 3 times, breaking and replanting as he goes and after that will return to his original position to wait for another redstone signal.

One solution would be to have the turtle inside the floor rather than standing next the to seed so it would have to move up twice before starting, but I'd much rather it not if possible.

#2 The_Cat

  • Members
  • 119 posts

Posted 05 March 2015 - 08:24 PM

Is there any more code? The only thing that i think will help would be to use a os.pullEvent().

This basicly waits for a redstone signal to change. This means you don't need to use the os.sleep().

Heres a link to the wiki.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users