first let me discripe my project in short way:
Im using a wii nunchuk-controller with an arduino to controll short wav-files(small soundfiles like a drumkick) played in pd.
I want to use an array to store which file shell be played (0 for none, 1, 2, 3, etc.). With a [select] pd choose the rhight file. The Arduino sents messages every 125ms.
This is working so far...
But now my problem: By pressing the "C"-Button the user decides to not play from the array but from his interaction-input. And by pressing the "Z"-Button the user decides to override the old array with his interaction-input. But the Array shell only have the length depending of the users-input (so that their is no pause in the loop or the array is to small).
So in my thougt I need to "reset" the array if the user hit the Z-Button and than resize the array +1 each intervall the Z-Button is pressed. But I can't find a way how to detect if the "1" from Arduino-input is sent the first time or in a row, so PD don't knows if it should count up or reset.
So is there a object or a construction giving the following logic:
bang if you got a 1 the first time, but do not bang if it is the second time without getting a 0 before?
I hope you understand me and have a solution. If not please ask or help me to explain better