I was writing a mining script for fun, i was aiming for it to able to go from point A to B by itself.
To handle the changes in orientation as required i wrote the following code.
*I could probably make this in a less contrived way, but i was figuring it out as i was going and this is how it turned out.
Spoiler
Code debrief
This function was intended to receive a desired orientation and align the turtle with it.
I used 0 as North, 1 as East, -1 as West and 2 as South.
I used a truth table based on (ttl.frontOritentation - toOritentation) to get at what should the movement be to get to the intended orientation.
The second if(toOrientation ~= ttl.frontOritentation) is for debugging purposes and prints the error message letting me know that the current orientation and target orientation at the time of the error.
The error
Basically the turtle was in the right orientation (North) and turned back (South), i don't know how if(toOrientation ~= ttl.frontOritentation) could allow this to happen
The variables at the time of error were :
frontOrientation = 2 (South)
originalOrientation = 0 (North)
toOrientation = 0 (North)
I visually confirmed the reported orientations are correct, the turtle was turned north and by the end of it turned South
Thx for your help.
I dont think the helper functions have anything to do with this but here they are.
Spoiler
P.s : My writing skills in English are fairly limited, if you need something clarified i will make my best to explain.











