reading a single value using metro

1mpar's icon

Hi,
I need to read a variable from an input so that I get a single value every X seconds.
this value should pass trhough an object to check if its value is 1 or 2 and then each of these variables triggers a counter.
I tried many objects, but I always get a lot of bangs on the output as I send a bang to the input. I need to get only one number each time the metro sends a bang.
What's the best way to do so? I'd been trying for some days and can't figure out a solution.
thanks,
1mpar

vichug's icon

[integer]

1mpar's icon

you can view part of the code in attachment

contador.maxpat
Max Patch
mzed's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'm not sure what the audio side is supposed to do. But, I changed your metro counter's carry flag mode to bang, and swapped your gate for an int object.

1mpar's icon

thanks a lot vichug!