cannot measure frequency with FreqMeasure.h library arduino 101 Curie

i am working with a project which is about heart beat measurement with arduino. That is why i have to measure the frequency from my lm324n op-amp. i am using FreqMeasure.h library for measuring the frequency but I get a error. does Arduino 101 not support this library? do i need to do some changes to let it work?

#include <FreqMeasure.h>

void setup() {

double sum=0;
int count=0;
float frequency;

void loop() {
if (FreqMeasure.available()) {
// average several reading together
sum = sum +;
count = count + 1;
if (count > 30) {
double frequency = F_CPU / (sum / count);
sum = 0;
count = 0;

So, where's that error of yours?

Also, please edit you post to have code-tags. See How to use the forum please.

do i need to do some changes to let it work?

Of course you do. The FreqMeasure library is NOT portable. It works for a very limited number of Arduinos.

thanks for your reply

I was already thinking this library was not made for the intel 101 board. Is there a easy way to measure accurate time between 2 pulse on the 101?

Is there a easy way to measure accurate time between 2 pulse on the 101?

That depends on the interval between the pulses. If they are a week apart, measuring the time to +/- 1 day is trivial. To +/- 1 millisecond isn't much more challenging.

If the frequency is more than once every 4 microseconds, then it becomes more challenging. You have to count a number of pulses, then divide by the time you did nothing but read pulses.

Thanks for your help,

I found this code.

will try with this one

volatile byte count = 0;
byte numCount = 8; //number of pulse intervals to measure

volatile unsigned long startTime;
volatile unsigned long endTime;
unsigned long copy_startTime;
unsigned long copy_endTime;

volatile boolean finishCount = false;
float period;

unsigned int rpm = 0;

void setup()
//pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), isrCount, RISING);//interrupt on pin2

void loop()
if (finishCount == true)
finishCount = false;//reset flag
// disable interrupts, make protected copy of time values
copy_startTime = startTime;
copy_endTime = endTime;
count = 0;

period = (copy_endTime - copy_startTime) / 1000.0; //micros to millis
//debug prints
Serial.print(period); //total time for numCount
Serial.println(period/numCount);//time between individual pulses

//rpm = numCount * 60.0 * (1000.0 / period);//one count per revolution
rpm = numCount * 30.0 * (1000.0 / period);//two counts per revolution

Serial.print("RPM = ");

void isrCount()
if (count == 0)//first entry to isr
startTime = micros();

if (count == numCount)
endTime = micros();
finishCount = true;
count++; //increment after test for numCount