Hi I’m trying to run two while loops each with a flat sequence. Will it create any trouble if these two loops run at the same time or can I put both flat sequences into a single while loop.
There isn’t much difference, but they aren’t identical either. Let me describe, and you select the one most appropriate.
Two loops are not necessarily synchronized. One could start and finish before the other even begins, and due to drift or jitter, after a larger amount of time, two loops running at the same rate could even have run different numbers of times.
A single loop synchronizes to its contents. It will not start again until everything inside of it has run once – switch structures don’t have to run all cases, but they have to run one. This means that the contents are guaranteed to be run the same number of times. If one is slow, they are both slowed, etc.
Sequence structures do nothing but guarantee execution order when there is no data passing from between the nodes. They aren’t really needed that often, but generally don’t do any harm unless you force the code to go in the wrong order. They are most useful for introducing delays between commands.
Greg McKaskle
Well that’s exactly what I wanted to do, create a delay while the robot arm engages until the next motor started. The problem that I faced was that I put two different sequence structures in the same loop but every thing went out of control. When I test each sequence individually it works, so does it that I should split both sequences into individual while loops instead of putting them in the the same loop?
If you don’t want them to be synchronized, yes, split them out. Does the unwanted synchronization explain the symptom you see?
Greg McKaskle