Need an example for RPM Measure with freqMeasure zero method

Status
Not open for further replies.

atmeltom

New member
Code:
/* FreqMeasure - Example with serial output
 * http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
 *
 * This example code is in the public domain.
 */
#include <FreqMeasure.h>

void setup() {
  Serial.begin(57600);
  FreqMeasure.begin();
}

double sum=0;
int count=0;

void loop() {
  if (FreqMeasure.available()) {
    // average several reading together
    sum = sum + FreqMeasure.read();
    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 https://forum.pjrc.com/threads/27482-zero-handling-in-FreqMeasure
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).
 
Status
Not open for further replies.
Back
Top