Hello,
I am trying to do an FFT over ADC using the Teensy3.2 but I have not had any success.Here is my code:
Please let me know as to what is going wrong.I connected the mic output (MEMs microphone INMP401 -sparkfun) to ADC A2 on the Teensy and running this code but no success.
I am trying to do an FFT over ADC using the Teensy3.2 but I have not had any success.Here is my code:
Code:
#include <Audio.h>
// GUItool: begin automatically generated code
AudioInputAnalog adc1(A2); //xy=178.3333282470703,125.33332824707031
AudioAnalyzeFFT256 myFFT; //xy=351.33331298828125,125.33334350585938
AudioConnection patchCord1(adc1, myFFT);
// GUItool: end automatically generated code
void setup() {
Serial.begin(115200);
delay(5000);
Serial.println("Hello");
// Configure the window algorithm to use
//myFFT.windowFunction(AudioWindowHanning256);
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
float n;
int i;
//if(myFFT.available())
if(1)
{
// each time new FFT data is available
// print it all to the Arduino Serial Monitor
Serial.print("FFT: ");
for (i=0; i<40; i++) {
n = myFFT.read(i);
if (n >= 0.01) {
Serial.print(n);
Serial.print(" ");
} else {
Serial.print(" - "); // don't print "0.00"
}
}
Serial.println();
}
}
Please let me know as to what is going wrong.I connected the mic output (MEMs microphone INMP401 -sparkfun) to ADC A2 on the Teensy and running this code but no success.