Patches

Counter

Counter

Create a counter that starts at 0 and can be incremented, decremented or set to a specific value. The counter is

  • incremented by one when the Increase port receives a pulse,
  • decremented by one when the Decrement port receives a pulse,
  • set to the value specified by the Jump to Number port when the Jump port receives a pulse.

Constrain the counter by specifying a value in the Maximum Count port. If the counter is incremented after it reaches this maximum value, it will reset to zero. Decrementing the counter from its initial value will wrap it backwards to the maximum value. If the counter is constrained, the “Jump to Number” value must fall within bounds, otherwise the counter will return to the starting value.

Often used to track a sequential state (ex: an onboarding flow) interchangeably with Option Switch. See State Basics for more information.

Counter

  • Increase
  • Decrease
  • Jump
  • Jump to Number
  • Maximum Count
  •  

Increase

A pulse that increases the counter value by 1.

Decrease

A pulse that decreases the counter value by 1.

Jump

A pulse that resets the counter to the value specified by the Jump to Number port.

Jump to Number

The number to use as the counter value when the Jump port is pulsed.

Maximum Count

The maximum counter value. The counter will reset to zero when the maximum value is reached. Note that the counter will always remain less than this value.

Output

The current value of the counter (ex: 0, 1, 2…)