# control::Count

    sys::Obj
      sys::Virtual
        sys::Component
          control::Count

`public class Count` `[niagaraIcon="module://icons/x16/control/util/step.png"]`

pulse counter object, counts transitions form 0 to 1 of input "in" Counts up if dir == true, counts down if dir == false Forced to preset value if enable = false In the case where dir == false, the counter will stop counting down at 0

dir

  `public property bool dir [config, falseText="down", defaultOnClone, trueText="up"]`

  Configures direction. True = "up", False = "down"

enable

  `public property bool enable`

  enable input

in

  `public property bool in`

  input, transitions from false to true increment out by 1

out

  `public property int out [readonly]`

  Number of times "in" property has transitioned from 0 to 1

preset

  `public property int preset [min=0, config, defaultOnClone]`

  Presets the counter to a specific value, defaults to 0

r

  `public property bool r`

  if r is true, out = preset and no counting takes place

execute

  `public virtual override void execute()`

  Execute is called once every scan. increment/decrement the count on rising edge of "in" if "enable" is true

reset

  `public action void reset()`

  Resets the counter to the "preset" value

start

  `public virtual override void start()`

  Override of start method to initialize the counter