Counting FRONTS

I've been through examples of sensors use (hall effect) to give the speed of turning devices. OK.

My need is to count (add) the fronts, to know how many turns made, for a long time, with a lap every xx minutes. I'm not sure attachInterrupt() is the right way to do this.

Any advice ?

Thanks.

I'm sure it is a right way (among many.)

I've no evidence of it

It is indeed a right way to do so. The right question you should ask yourself is not "is there evidence it is a right way?" but it is "is there evidence it is NOT a right way?". The answer to this question is determined by the specifications of your system and the devices you use.

So tell me, why would it be a bad way to do so according to you?

First evidence : So far I haven't seen any project doing so.
Second evidence : How high will be the counter with a numeric signal above 50Hz (at least) after one hour, one day, one week ?

First evidence is not an evidence. I've made an encoder attached to a DC motor an I use interrupts to count the "tops". Works pretty well. I don't see any other way to do without an ASIC (or a PLD).

Second evidence: using an unsigned long which is 2^32, at a 50 Hz frequency it will take about 1000 days (a little less than 3 years) to overflow. However, nothing prevents you from using one more variable to deal with overflow.

If you want to count something that repeats every "xx minutes" you do not need to use interrupts - polling should be fine unless the event you want to count has a very short duration (a few microseconds). But you certainly could use interrupts if you know how.

...R