Arduinofft 2
Arduinofft 2
h"
int j=0;
int aux=0;
float freq[20];
double vReal[SAMPLES];
double vImag[SAMPLES];
void setup() {
Serial.begin(115200);
sampling_period_us = round(1000000*(1.0/SAMPLING_FREQUENCY));
}
void loop() {
for (int i = 0; i < SAMPLES; i++) {
microseconds = micros();
vReal[i] = analogRead(A0)*5/1024;
vImag[i] = 0;
while(micros() < (microseconds + sampling_period_us)){};
}
FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_FLT_TOP, FFT_FORWARD);
FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);
FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);
double peak = FFT.MajorPeak(vReal, SAMPLES, SAMPLING_FREQUENCY);
}
//Serial.println("--------------");
for(int j=0;j<aux;j++){
//Serial.println(freq[j]);
}
Serial.print("pico: ");
Serial.println(maior);
Serial.print("freq: ");
Serial.print(peak);
//Serial.println("hz");
while(1);