Google "peak detection algorithms" for lots of ideas. Your simple approach won't work for noisy data.
Note: if you ever do use the FFT algorithm, it is a serious mistake to comment out this line.
//fft_input[i+1] = 0; // set odd bins to 0
Google "peak detection algorithms" for lots of ideas. Your simple approach won't work for noisy data.
Note: if you ever do use the FFT algorithm, it is a serious mistake to comment out this line.
//fft_input[i+1] = 0; // set odd bins to 0