## Positive / negative sensor values

Apr 20, 2010 at 9:36am

# Positive / negative sensor values

Hello !

Can someone help me on this ?

– Pasted Max Patch, click to expand. –

I would like to know why all the bang ojects are banging at the same time even if my values are matching only one of the 4 conditions ?

Is there a better way to say to max :
- if a>0 and b>0 then bang
- if a0 then bang
- if a

#49865
Apr 20, 2010 at 9:37am

By the way, my values are received with a 25Hz sampling rate, and I can up this rate to 200 Hz

#179092
Apr 20, 2010 at 9:53am

Hi,
Because you have “else clear” the if object output “clear” if the condition is not true. The bang object show it as a bang.
Also, the right input needs to trigger the left one.

– Pasted Max Patch, click to expand. –

Y.

#179093
Apr 20, 2010 at 12:16pm

Oh thanks it is now clear to me ;)

Have a nice day

Mathieu

#179094
Apr 20, 2010 at 6:45pm

Is there a better way to say to max :
- if a>0 and b>0 then bang
- if a<0 and b>0 then bang
- if a<0 and b<0 then bang
- if a>0 and b<0 then bang
But only one condition could be matched at the time.

let me try that freehand without maxmsp.^^

[if \$f1>0 && \$f2>0 then bang]
[if \$f1<0 && \$f2>0 then bang]
[if \$f1<0 && \$f2<0 then bang]
[if \$f1>0 && \$f2<0 then bang]

[if (\$f1>0 && \$f2<0) || (\$f1<0 && \$f2>0) || (\$f1<0 && \$f2<0) || {\$f1>0 && \$f2<0} then bang]

(of course that will always bang, but you asked for it)

or with expr:

[expr \$f1>0 && \$f2>0] – [select 1]

-110

#179095

You must be logged in to reply to this topic.