FreqMeasure issue

Status
Not open for further replies.

Aghosca

New member
Hello,

I've imported the library <FreqMeasure.h> on Arduino 1.6.7 IDE, I'm using arduino UNO.
Using the example code below, I get one error when compiled the sketch.
The line "float frequency FreqMeasure.countToFrequency(sum / count);"
Error received "expected initializer before '.' token"
Can someone give an advice?

Thaks in advance


#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);
sum = 0;
count = 0;
}
}
}
 
Looks like you deleted an equals sign, which created a syntax error.

Here's the original code. Notice how line 22 in the original is slightly different?

https://github.com/PaulStoffregen/F.../examples/Serial_Output/Serial_Output.pde#L22

Yes! It work fine now. Thanks Paul!! I just copy and past the code present on the following page https://www.pjrc.com/teensy/td_libs_FreqMeasure.html
Line 22 has not the equals sign, I'm an Arduino and programming newbie and not able to fix it alone :p :p

A.
 
Status
Not open for further replies.
Back
Top