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

Turtle redstone detection

Started by henkekalmar, 05 March 2015 - 11:35 AM
henkekalmar #1
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.
The_Cat #2
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.