Forums > MaxMSP

alarm door mat problem with constantly bang

Aug 23 2013 | 8:09 am

hello all!

i hope my english is good enough to describe the problem.
so i work on a project with alarm door mats, the idea is kids can play with 8 mats sound in the kindergarden.
the communication between arduino and max msp and reason works fine.

i have two values 0 and 1 in max i say is $1>0 then bang it works good but the problem is the mat/value does trigger the bang constantly when you stand on the mat.
it means the midi note is playing constantly from the beginnig when you stand on the mat more as a milli second.
thats a problem because it sounds not good.

have anybody a idea for fix that problem?

i search a lot about this problem but i don´t found a reason.

best regards

— Pasted Max Patch, click to expand. —
  1. door_mat.maxpat
Aug 23 2013 | 8:21 am

[select 1]

Aug 23 2013 | 8:57 am

thanks for the quick response

I tried this yesterday it does not work.
in this case, the bang never triggered.

I’ve attached the new patch.
you may find my error?

where do I make the error I do not get it??
I know, it’s only a small error but I can not find it

thank you thank you

— Pasted Max Patch, click to expand. —
Aug 23 2013 | 9:48 am

Please send your patches as "copy compressed".

About your problem: you need to check for 0->1 and 1->0 transitions.

if you program your arduino yourself, you could add the logic in the arduino itself and send only values on transition.

In Max, you could use change or maybe even togedge.

Aug 23 2013 | 9:57 am

Most likely the bang did trigger, but only once, and you missed seeing/hearing it (maybe). the [change] object is definitely what you need, because Arduino sends the values constantly, and you only want something to happen when someone gets on the mat or jumps on it, thereby changing the value. Be sure that if they jump, the Arduino is in fact sending a 0 at some point (maybe using [print]) to show that they have jumped, otherwise you’ll always get a 1, and coming out of [change], you’ll only get it once.

You can also reset [change] with a "set" message, so it thinks the last incoming number was whatever you put in "set". You could attach a [delay 1000] to anything coming out of [change], then a "set -1" back into it. This will cause something (either a 1 or 0, whatever is coming from the Arduino) to be output from [change] once per second, for testing purposes. When you have everything working, take out the [delay] and "set" message.

Aug 23 2013 | 9:36 pm

schmid, your mistake was in the if statement preceding the change object.

— Pasted Max Patch, click to expand. —
Aug 24 2013 | 3:53 am

thanks to all for the great input!
nice community!

Thanks for the great elegant solution.
I see the error now, it was simply a logic error!
But your solution I had not come by itself!
thank you


Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP