Hi there!
We are working on a guitar tuner using Arduino. This was supposed to get the input frequency by means of FreqMeasure library but it's actually not working properly. The thing is, after having the entire code written, we realized that something was going wrong, so we decided to start using the "Serial Output" example given in the lines below:
#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) {
double frequency = F_CPU / (sum / count);
Serial.println(frequency);
sum = 0;
count = 0;
}
}
}
Our input frequency came from a function generation, but although we were changing the value of the input frequency, Serial displayed each the same one.
Any suggestion to fix it?
We are working on a guitar tuner using Arduino. This was supposed to get the input frequency by means of FreqMeasure library but it's actually not working properly. The thing is, after having the entire code written, we realized that something was going wrong, so we decided to start using the "Serial Output" example given in the lines below:
#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) {
double frequency = F_CPU / (sum / count);
Serial.println(frequency);
sum = 0;
count = 0;
}
}
}
Our input frequency came from a function generation, but although we were changing the value of the input frequency, Serial displayed each the same one.
Any suggestion to fix it?