Go Down

Topic: Frequency / period counter (Read 8871 times) previous topic - next topic

robtillaart

Quote
is there any way with this library to get Hertz in a decimal?
I need accuracy up to about 850Hz, to calculate engine RPM.
Having hertz only as a whole number is reducing the accuracy.


change the freq to be float iso long wouyld be the first step ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

nitrolx

Is there a way to run 2 instances of this counter at once?
I need to measure 2 discreet frequencies.
One can be an interrupt, the other would have to be with polling (as my other interrupt pin is doing another job in this project).

I try and compile with;

FreqPeriodCounter counter(counterPin, micros, 0);
FreqPeriodCounter counter2(shaftPin, micros, 0);

but it throws up errors as all the variables (counter.hertz, counter.period etc etc) are being defined twice.

Can I copy the library files to another one, call it FreqPeriodCounter2, and add a 2 to all the variable names? Would that work??

Go Up