kopia lustrzana https://github.com/kosme/arduinoFFT
Ensure accurate sampling frequency in FFT_03.ino
rodzic
92f4066a72
commit
c564008306
|
@ -53,15 +53,15 @@ void setup()
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
/*SAMPLING*/
|
/*SAMPLING*/
|
||||||
|
microseconds = micros();
|
||||||
for(int i=0; i<samples; i++)
|
for(int i=0; i<samples; i++)
|
||||||
{
|
{
|
||||||
microseconds = micros(); //Overflows after around 70 minutes!
|
|
||||||
|
|
||||||
vReal[i] = analogRead(CHANNEL);
|
vReal[i] = analogRead(CHANNEL);
|
||||||
vImag[i] = 0;
|
vImag[i] = 0;
|
||||||
while(micros() - microseconds < sampling_period_us){
|
while(micros() - microseconds < sampling_period_us){
|
||||||
//empty loop
|
//empty loop
|
||||||
}
|
}
|
||||||
|
microseconds += sampling_period_us;
|
||||||
}
|
}
|
||||||
/* Print the results of the sampling according to time */
|
/* Print the results of the sampling according to time */
|
||||||
Serial.println("Data:");
|
Serial.println("Data:");
|
||||||
|
|
Ładowanie…
Reference in New Issue