Quote:
Originally Posted by apm4242
Because more than one switch can be activated at a time, do I have to code something that will prevent selecting two autonomous modes simultaneously? If so, what would that look like?
|
There isn't any way for you to prevent more than one virtual digital input from being active at the same time. If you wish to use individual inputs to activate specific autonomous modes, you'll have to decide how to make one take precedence over others.
You could turn the boolean array into a number from 0-255 and make the cases something like (128..255), (64..127), (32..63), (16..31), (8..15), (4..7), (2..3), (1), and (0, Default). That will give you eight different modes to choose from, with the leftmost selected one having priority if multiple inputs are on. The Default case will be selected if none of the inputs are turned on, so you can leave it empty and have it be a "do nothing" mode.
If that sounds like a lot of work for the programmer, you could use a binary-coded number to select among modes, though that's not especially friendly for the person choosing it. Or you could use one of the virtual analog inputs, and make certain ranges of values choose certain modes.
Quote:
|
Also, is it possible to place a flat sequence structure inside a case block?
|
It's not only possible, it's probably the most common way teams implement multiple autonomous modes.