#N canvas 248 25 581 856 10; #X obj 59 21 cnv 15 300 30 empty empty Counters_in_Pd 20 12 0 14 -233017 -66577 0; #X obj 174 132 + 1; #X obj 172 276 + 1; #X obj 130 276 f 0; #X obj 272 132 + 1; #X obj 236 132 f 0; #X obj 114 132 float 0; #X text 207 133 ==; #X text 311 135 ~=; #X obj 380 132 + 1; #X obj 344 132 f; #X text 66 168 Every bang sent to the float will first output the current value of the float to its outlet and to the [+ 1] \, which then adds 1 to the internally stored value of the float *without* outputting it immediatly.; #X text 64 226 The new value will be emitted on the next bang.; #X floatatom 130 307 5 0 0 0 current_output - -; #X msg 130 254 bang; #X floatatom 172 308 5 0 0 1 next_output - -; #X obj 192 497 + 1; #X obj 150 497 f 0; #X floatatom 150 528 5 0 0 0 current_output - -; #X msg 150 432 bang; #X floatatom 192 528 5 0 0 1 next_output - -; #X msg 166 460 0; #X obj 70 340 cnv 15 300 20 empty empty Resetting_Counters 20 10 0 12 -233017 -66577 0; #X obj 67 588 cnv 15 300 20 empty empty From-To-Counters_(Modulo-n) 20 10 0 12 -233017 -66577 0; #X obj 197 757 + 1; #X obj 155 757 f 0; #X floatatom 155 817 5 0 0 0 current_output - -; #X msg 155 699 bang; #X msg 171 726 0; #X obj 155 784 mod 4; #X text 92 634 If you want to count from 0 to a max-value and then start over \, use a "Modulo N" counter. Note \, that the [mod] is inserted *between* the float and the [+ 1] addition. To count until N use a [mod N-1] object:; #X text 65 75 Counting in Pd doesn't require externals \, you can also count with the builtin objects. The basic idiom to remember is [f 0] x [+ 1]:; #X text 212 785 <= count from 0 to 3 (where 3 == 4 - 1); #X floatatom 111 774 5 0 0 0 - - -; #X text 87 376 To start over \, send the new starting value to the right outlet of the float:; #X text 193 459 <= RESET using right inlet of float; #X connect 1 0 6 1; #X connect 2 0 3 1; #X connect 2 0 15 0; #X connect 3 0 2 0; #X connect 3 0 13 0; #X connect 4 0 5 1; #X connect 5 0 4 0; #X connect 6 0 1 0; #X connect 9 0 10 1; #X connect 10 0 9 0; #X connect 14 0 3 0; #X connect 16 0 17 1; #X connect 16 0 20 0; #X connect 17 0 16 0; #X connect 17 0 18 0; #X connect 19 0 17 0; #X connect 21 0 17 1; #X connect 24 0 25 1; #X connect 25 0 29 0; #X connect 25 0 33 0; #X connect 27 0 25 0; #X connect 28 0 25 1; #X connect 29 0 26 0; #X connect 29 0 24 0;