Codebox Operators counter

counter

new counter([options])

Options

NameTypeDefaultDescription
initnumber

The initial value from which to begin counting. Note that this only applies to the first count loop and only when counting is enabled at startup (reset 0), because resetting the counter~ during run time will always start counting from zero.

Methods

next(a, reset, limit): [out1, out2, out3]

Arguments

NameTypeDefaultDescription
anumber
resetnumber
limitnumber

Returns

NameTypeDescription
out1number

The current value of the counter as a signal.

out2number

Outputs a signal value of 1. whenever the limit value is reached, otherwise outputs a 0.

out3number

The total number of times the counter~ object has reached the limit since the last reset, as a signal value. Sending a non-zero value to the middle inlet resets the carry count.

reset(): void