08-12-2012 03:44 PM
I'm trying to figure how to do a comparison or case structure...based on the setting of an array of 3 (or possibly more) boolean.
Say I have an array (this is coming in from a serial connection, and I'm coverting it back to array to work with) of [T,F,F] in this case I'd like to display on a status indicator "STBY"
If the array is set to [F,T,F] I'd like to display in that indicator "ON"
If the array is set to [F,F,T] I'd like to display in that indicator "EMPTY"
I can't figure out how to compare combinations of things....I"m reading in a byte array, and the first 3 bits in this example, determin what I need to display as status...I can't figure how to do with with a case structure.....or without doing some nasty looking and/or comparison chains...
Any suggestions?
Thanks in advance,
cayenne
Solved! Go to Solution.
08-12-2012 03:46 PM
You could use Search 1D array and find the first True.
Or you could convert the Boolean Array to a U8 integer, and use resulting integer to determine which case to run. (4, vs, 2, vs 1)