3 input AND gate
Hi all,
I'm trying to make a three-input AND gate and I'm a bit stuck. Below is what I have. I presume I'm missing something very simple?!
it is easier to use arithmetics.
up to 8 inputs using expr:
expr ($i1+$i2+$i3+$i4+$i5+$i6+$i7+$i8)==$i9
where the last argument is the number of inputs you want to use.
for 3 you can reduce it to ($i1+$i2+$i3)==3
Thanks Roman, but that doesn't work for me. I get a bang whenever I change the first input, regardless of what the other number boxes are set to (even 0).
oh, and otherwise it would be &&, not &!
& is bitwise-and.
a bang? it outputs 1 and 0 (true or not true)
Sorry yes that's what I meant. I'm still getting a zero output regardless of the input?
hey Phil,
does this work for you?
Thanks! But still getting nothing but zeroes...
okay, can you briefly describe in plain language the calculation you're trying to do?
is the trouble rooted in using logical operators for this? I see you're using floating numbers...
I'm after a three input AND gate that takes floats from 0-1 and outputs a bang (or a 1, whichever), when the three inputs are all above a given threshold (say 0.5).
The scaling in the wider patch is all 0-1 so that would be the most convenient, but if ints work better then I'll go with that.
EDIT - the input for this is a series of fluctuating numbers from a motion sensor. The idea is to have moments where three different values from the sensor trigger a bang when they get above a threshold.
hehe, maybe make a fresh numberbox with no limits set?

ah, gotcha - yeah, I'd still think we're in the "multiple conditions" side of things.
You can either do three "sensor > threshold" operations and then AND those *afterwards*, or you can do something like this?
change object optional, depending on your needs.
oh, and you can use a big [join 4 @triggers -1] to group up all your floats instead of the pak+tbf
hmm, so if I was ANDing them afterwards, I could run them into the example that Roman posted above?
yeah, basically you'd be doing three separate logical operations, giving you three binary outputs, and you'd just be adding up the zeros and ones and seeing if you get a three.
oh, should we have been doing [expr $f1 > $f4 && $f2 > $f4 && $f3 > $f4]? I guess.
Tried it and that works! I think I have what I need now. Thanks everyone :)