# \[New Node\] @eswarpr/node-red-modn-counter

**URL:** <https://discourse.nodered.org/t/new-node-eswarpr-node-red-modn-counter/73416>\
**Category:** Share Your Nodes\
**Created:** [9 January 2023 14:57 UTC](https://discourse.nodered.org/t/new-node-eswarpr-node-red-modn-counter/73416 "2023-01-09T14:57:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eswarpr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eswarpr/32/74001_2.png) [@eswarpr](https://discourse.nodered.org/u/eswarpr)\
**Post date:** [9 January 2023 14:57 UTC](https://discourse.nodered.org/t/new-node-eswarpr-node-red-modn-counter/73416/1 "2023-01-09T14:57:55Z")

</div>

A node inspired by mod-N/divide-by-N counters like SN74LS90/92 logic ICs. I needed this, as I am building some 555 timer based experiments, and I do not have any hardware counters yet. Thought I will simulate it in node-RED in the meantime. Releasing it to public in case others need to use this.

The examples have been released with the latest package that demonstrates:

- Using the counter by itself and as a delay based on incoming data.
- Using the counter in a series with other mod-n counters to count and delay execution based on incoming data
- Using the counter and resetting it from another part of the node when needed.

The input to the counters can be:

- An array of JSON objects with 2 properties: _topic_ and _value_. Topic may be "reset" or "set" depending on what you want the counter to do, and value could be 1 or 0. When resetting the node will expect the value to be 1
- A JSON object with a similar structure as detailed above
- A numeric payload with a value of 1 or 0, which will be assumed as a "set" operation by the node

Find details about the node at [this link](https://flows.nodered.org/node/@eswarpr/node-red-modn-counter)
