hello guys ,,
am trying to read a frequency for a sine wave signal and it's generating from Speakers (Audio Signal) so it's not a single sine wave signal,, on oscilloscope it's shown as multiple signals ..
the problem that when am trying to read the frequency for this signal it always gives me 0 :~
I am using the FreqCounter Library with the following code,,,, any suggestions for a solution:
#include <FreqCounter.h>
void setup() {
Serial.begin(9600); // connect to the serial port
Serial.println("Frequency Counter");
}
long int frq;
void loop() {
FreqCounter::f_comp= 8; // Set compensation to 12
FreqCounter::start(100); // Start counting with gatetime of 100ms
while (FreqCounter::f_ready == 0) // wait until counter ready
frq=FreqCounter::f_freq; // read result
Serial.println(frq); // print result
delay(20);
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.