I’m trying to design a piston that will repeat a certain number of times OR until successful for locking a door.
I keep bouncing back and forth between using the For Loop and Repeat Loop. The problem is I don’t know how to end either one when successful.
For instance, my piston locks a door. After it sends the lock command I plan to have it wait 10 seconds, then evaluate the lock condition. If the lock is locked, no action taken. If the lock is still unlocked or jammed, then I want it to retry locking 5 times. So, unlock, wait a few seconds, lock. Repeat 5 times, OR, if successful, end.
If I use the Repeat Loop it seems it will do it infinitely until it locks, which I don’t want. If I use the For loop, it seems it will do it 5 times even if it locks on the 3rd try for instance.
What obvious solution to this problem am I missing? Thanks in advance!
EDIT: Here’s what I have. No idea if it works or not yet.