Skip to content

Commit

Permalink
Fix to issues #6 and #7. Cleaning imaginary to avoid OVF.
Browse files Browse the repository at this point in the history
  • Loading branch information
Enrique Condes committed Aug 28, 2017
1 parent 8952252 commit 690c071
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Examples/FFT_01/FFT_01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void loop()
{
vReal[i] = int8_t((amplitude * (sin((i * (twoPi * cycles)) / samples))) / 2.0);/* Build data with positive and negative values*/
//vReal[i] = uint8_t((amplitude * (sin((i * (twoPi * cycles)) / samples) + 1.0)) / 2.0);/* Build data displaced on the Y axis to include only positive values*/
vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
}
/* Print the results of the simulated sampling according to time */
Serial.println("Data:");
Expand Down
1 change: 1 addition & 0 deletions Examples/FFT_03/FFT_03.ino
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void loop()
for(uint16_t i =0;i<samples;i++)
{
vReal[i] = double(analogRead(CHANNEL));
vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
if(samplingFrequency<=1000)
delay(delayTime);
else
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=arduinoFFT
version=1.2
version=1.2.1
author=kosme <enrique@shapeoko.com>
maintainer=Enrique Condes <enrique@shapeoko.com>
sentence=A library for implementing Fast Fourier Transform on Arduino.
Expand Down

0 comments on commit 690c071

Please sign in to comment.