rpschultz13
Member
Hi,
Trying to figure out how to use this library FreqMeasure, on Arduino first and then Teesy. Example code below. Where do I tell it what input pin is used?
Ultimately trying to build a guitar tuner. I'm currently using an older frequency measure code, this one seems better. I've applied a voltage offset to get the input signal into the range.
Thanks!
---------------------------------
-------------------------
Trying to figure out how to use this library FreqMeasure, on Arduino first and then Teesy. Example code below. Where do I tell it what input pin is used?
Ultimately trying to build a guitar tuner. I'm currently using an older frequency measure code, this one seems better. I've applied a voltage offset to get the input signal into the range.
Thanks!
---------------------------------
Code:
#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;
}
}
}
Last edited by a moderator: