Go Down

Topic: Zero and AudioFrequencyLibrary (Read 883 times) previous topic - next topic

AddeBC

Ok. I am totally lost and dont know how to move forward.

I have a Adafruit MAX4466  MIC  connected to A0   power to 3 v and then ground cable...


I tried the Example and it freezes in the Setup()  on the row meter.begin(A0, 960000);

I have Serial.printf before and after... i only get the first...


The code below only prints out "Start" nothing else happens


Code: [Select]

#include <AudioFrequencyMeter.h>

AudioFrequencyMeter meter;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Start");

//  meter.setBandwidth(70.00, 1500);    // Ignore frequency out of this range
  meter.begin(A0, 960000);             // Intialize A0 at sample rate of 45kHz
    Serial.println("adde");
}

void loop() {
  // put your main code here, to run repeatedly:
  float frequency = meter.getFrequency();
  if (frequency > 0)
  {
    Serial.print(frequency);
    Serial.println(" Hz");
  }
}



AloyseTech

It seems that you're trying to set a sample rate of almost 1MHz (960000Hz), which is a lot knowing the library is made to measure up to 1.5KHz. Even if it is what's in the example, it may be an error : this page indicate that the second parameter is the sample rate in Hz...

Maybe try to reduce it to something like 15000, that should be enough.

AddeBC

I hope it is that easy, will try when i get home from work.... I will report back here, maybe somone then could update the Exampel sketch and code on webpage....


AddeBC


AloyseTech

Have you tried lower value for the sample rate? Are you using the mic at 3.3V?

AddeBC

Yes 3.3 v and yes i have tried loads of different values....

But to be honest if the example code is wrong wouldnt there be more comments regarding this on the web...

It wont type out any Hz at all.... but when i tried a very low value it did go past the begin line but nothing after  that.

Go Up