#N canvas 512 43 668 510 12;
#X floatatom 214 200 4 0 0 0 - - - 0;
#X obj 214 174 + 1;
#X obj 214 121 metro 500;
#X msg 123 124 stop;
#X obj 214 148 float;
#X obj 214 92 trigger bang bang;
#X msg 330 119 0;
#X obj 123 98 select 10;
#X text 363 113 first set value to zero, f 13;
#X text 344 92 initialization is in two steps;
#X text 337 147 (before starting the metronome);
#X obj 130 353 >= 0;
#X obj 130 379 select 0 1;
#X obj 163 434 float;
#X obj 217 435 + 1;
#X msg 130 405 -1;
#X text 396 464 updated for Pd version 0.34;
#X text 51 77 conditionally stop the metronome, f 13;
#X text 293 194 select can be abbreviated as:;
#X obj 509 193 sel;
#X floatatom 130 327 4 0 0 0 - - - 0;
#X floatatom 217 461 4 0 0 0 - - - 0;
#X obj 214 66 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 235 65 <-- click here to start;
#X text 49 13 Here's a counter that counts from 1 to 10 using [metro]. When receiving a "bang" message \, [metro] is turned on \, and it stops when receiving a "stop" message., f 72;
#X obj 173 407 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 196 406 <-- as a result either clear or increment the counter;
#X text 208 378 <-- selectively bang the first or second outlet;
#X text 169 353 <-- are we nonnegative? (1 if true \, 0 if false);
#X text 54 241 We're using one new object \, [select] \, which outputs a bang when it gets a matching value (10 in the case above). This is useful for doing conditional computations. Below \, we count while the input is 0 or positive and clear the counter when negative:, f 75;
#X connect 1 0 0 0;
#X connect 1 0 4 1;
#X connect 1 0 7 0;
#X connect 2 0 4 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X connect 5 0 2 0;
#X connect 5 1 6 0;
#X connect 6 0 4 1;
#X connect 7 0 3 0;
#X connect 11 0 12 0;
#X connect 12 0 15 0;
#X connect 12 1 13 0;
#X connect 12 1 25 0;
#X connect 13 0 14 0;
#X connect 14 0 13 1;
#X connect 14 0 21 0;
#X connect 15 0 13 0;
#X connect 20 0 11 0;
#X connect 22 0 5 0;
