-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turned your code into a Class / library #1
Comments
This is excellent @MichielfromNL. Thanks for the efforts. I'll add the links to this post of yours in the Readme, and also in the Medium tutorial on FFT onboard ESP32. |
I have tried this out with a frequency sweep , generated from my computer and input via my ESP32's ADC, and it seems that no matter the input frequency, only the highest frequency bins have the strongest peaks |
Can you share some more details on the input and output and also share code snippets? |
Thank you making it a Library; unfortunetly, I am receving errors for constructor. As I am not a master of C++ can you please help me with this Error while Compiling
|
I suspect the compiler flag [-Werror=reorder] triggers , because the order of class variables in the header file is not exactly as the order of the initaliser list in the constructor. It is now: Change it into: private: Hope this helps |
Thank you for your prompt reply. It worked; no compilation Error now. |
Nice job, great! |
@MichielfromNL thank you for your effort to make this code more object-oriented, it's very much appreciated. OTOH, I believe there is a mistake in the definition of the _binwidth member (and consequently, the output of the frequency() method is likely wrong): I believe it should read simply "(float) samplefreq /_size;", as only half the sampling frequency bandwidth is available (Nyquist theorem), so the 2.0 gets simplified away.. |
@MichielfromNL thank you very much for your effort. FYI, there is a problem in the implementation of the function complexToMagnitude. After calculating _max_mag and _fundamental_freq, these values will never be updated if the new values aren't bigger. I fixed locally this behavior by resetting them in each call of complexToMagnitude. https://gist.github.com/diplab-projects/8551fa44b44abf5a35ec8a16681761fa Oh, and BTW:
You are absolutely right. I tested this with real data, and the frequency will be doubled. |
Can anyone give a snippet or some help to use the library with input in ADC? Im trying to use it with current and voltage sensors so I can get the amplitudes of the harmonics. But it isnt working right. Thanks |
Hi,
I was using ArduinoFFT sofar, and found your code when I was looking for a faster FFT for my project.
Which worked fine, super!
I spend a few hours today to turn it into a class, added some functions to make it work just like ArduinoFFT and made it a tad more "user friendly". the zip installs as an arduino library
Best regards,
Michiel
ESPfft.zip
The text was updated successfully, but these errors were encountered: