How to program three separate mechanisms

The “Switch” command will be your friend here.

Here’s a short example. By placing the switch monitoring in Case 0, we can effectively stop looking at the sensors, because we only care about their result when the Robot_step variable is = 0. We can then decide at which points during our program we want to care about the sensors. For example, if your process is sequential such that if Object 1 is executing, and needs to then do Object 2 and Object 3 EVERY TIME, we don’t want to care about the sensor status until Object 3 has finished executing.

We can use simple Assignment commands to control the value of Robot_step, and the Switch statement will then execute the block of code under the Case line that has the same value as Robot_step. So in this example, I have linked each case together by assigning Robot_step to the next value. This means I can be dropped into any point of the program, and will carry out all steps up to step 3, at which point I go back to Case 0, where I wait for the next sensor input.

1 Like