Need an example for RPM Measure with freqMeasure zero method

Not open for further replies.


New member
/* FreqMeasure - Example with serial output
 * This example code is in the public domain.
#include <FreqMeasure.h>

void setup() {

double sum=0;
int count=0;

void loop() {
  if (FreqMeasure.available()) {
    // average several reading together
    sum = sum +;
    count = count + 1;
    if (count > 30) {
      float frequency = FreqMeasure.countToFrequency(sum / count);
      Serial.println(frequency * 60);
      sum = 0;
      count = 0;

Im just wanna have the RPM also on Zero with this sketch it doesnt work :(

Im just beginner and read also the tread with freqmeasure with zero but im stucked here .Too much input!!!:(

Im sure anybody oder Paul Stoffregen can help me with an working example!:cool:

Im need this to finish my project OMG!!

Thanks in Advance :p

PS: The Code im found in a tread here
is just crap and dont working
Last edited:
FreqMeasure measures the time between pulses.

If the pulses stop, the only way to conclude the output is zero is to add timing-based code. You can use an elapsedMillis variable or read the millis() count, or a number of other more complex techniques. That part is up to you.

Fundamentally the FreqMeasure only gives you the time between pulses. It's up to you to decide how to actually use that information (or the lack of information if pulses are missing).
Not open for further replies.