How do I count the number of incoming signals?
I have four simple wires and I need logic which reacts when two of them are active. I tried using a combiner outputting to a calculator, and then checking if the value is greater than 2, but the results are weird!
One signal is 1.0
Two signals are 1.41
Three signals are 1.73
Four signals are 2.0
Hmm! That's the square root of the number I was expecting! Well I thought - I'll square it then check if it's greater than 2.
Nope, 2^2 output to another calculator is... 2. What's going on here, and how can I make this work?
-
For now I'm just checking if the value is greater than the square root of 2, but it's a bit of a hack. I'd love to know what's really going on and how to do this properly.
-
Nope that doesn't work either!
-
Create a Calculator gadget and check if each signal is Greater Than Zero. Sum those Calculator outputs together to get the number of active signals.
-
So for four inputs I would need 3 calculators? First sum two pairs of inputs, then sum the sums?
-
Yeah, there's not really a way around needing N-1 calculators to sum N values together.
-
Great, thanks!
-
If they're all sending 1, you should be able to just add them together to find out how many are activated. Or you can try using an AND gate or something?
Another thing to fiddle with is the "blend mode" of an incoming signal. There are three modes, and one of them is a "weighted average" which might be your problem. Perhaps one of the other modes would give you a mode useful signal to work with?
請登入寫評論。