CORE - Revolving Counter

(James) #1

Hi @alanrosesf

I’m new to CORE and I’ve been trying to setup a piston (first picture below) which will activate a virtual motion sensor when more than 1 of my 6 ST Motion Sensors are activated within x seconds of each other. The only option I can find are ‘Any’ or ‘All’ as per the below piston.

It has been suggested that your Revolving Counter Piston may help me create what I’m looking for (e.g. if number of triggers (iterations) get to 2, then activate Virtual Motion Sensor and reset count to 0), but I’m struggling to set that up correctly and understand it enough to apply it to my requirement.

Are you able to help please?

I have inserted a screen grab below showing where I am stuck. What goes in the ‘Variable name’ and ‘Comparison’ fields to create the If Count Variable?

(Alan) #2

Hello. I’ll try and assist you if I can.

In my example, the variable ‘count’ will act as the, well, the counter. The variable ‘iterations’ is the total number of times you want to pass before you reset the ‘count’ variable back to 0. So we need to increment ‘count’ each time something is tripped. Think the one millionth customer that comes into a store. After a million, reset the counter back to 0 and hope you get another million customers.

If I understand your question, you are asking how to set up your conditional statement for your first ‘if’, correct? If so, and based on the example I gave, you would be placing the ‘count’ variable into the first condition. The Comparison would be ‘is less than’ and the Variable value in my example is ‘iterations’.

Hope this helps.