Counter on rising edge only

I am using rpi to calculate number of pieces
I need to increment each rising edge through the rpi
Then if the switch ui node is on the counter stops and if it is off it increments from the last value it stopped
It returns to 0 after 8hours
any help?

Hello and welcome to the Forum.

It would help if you can share what you have tried so far and which part is causing the problem.
e.g. Can you share your Node-RED flow.

By default the UI switch node sends a single boolean payload true when it changes from OFF to ON and false when it changes from ON to OFF.

So your counter (maybe a function node, using a context variable) only needs to count messages with payload true.
Either test it in the function or use a switch node (not a ui-switch) to only pass messages where msg.payload is true.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.