logic, testing multiple toggles

    Jan 28 2011 | 3:52 pm
    Hello all.
    I know there is an elegant way to do this, but I don't have any idea how to do it well, and my basic effort has failed. I'll bet there is an object that does it.
    I have 7 toggles and I want to see if any one of them is on. If any are, set output to 1. If not, 0.
    I tried this and it did not work: if $i1 !=0 || $i2 !=0 || $i3 !=0 || $i4 !=0 || $i5 !=0 || $i6 !=0 || $i7 !=0 then 1 else 0
    Thanks! Matt

    • Jan 28 2011 | 3:59 pm
      Note that using (a[0] || a[1]) is saying, if a[0] is not zero OR a[1] is not zero, then the expression in parentheses is not zero
      Also, giving jstrigger more than one expression in parentheses will give it more than one output, so you can have one jstrigger object interpreting complex combinations of quantities in more than one way to give you different analysis results fromt he same set.
    • Jan 28 2011 | 4:06 pm
      One way:
    • Jan 28 2011 | 4:15 pm
      Well, I have come up with a way to do it. This might not be the ideal solution, but it is simple and it works.
    • Jan 28 2011 | 4:18 pm
      Patrick, I didn't refresh before posting mine. It's great that we were thinking along the same track! Thanks so much folks for getting back on this one, very helpful.
    • Jan 29 2011 | 2:21 am
      the oft-overlooked [decode] object might also interest you, especially if you plan to expand to other logic tests. great for things like solo/mute of multiple channels/toggles.