Good day everyone.

I’m trying to let my Arduino do an FFT of input signal, and then tell me what is the frequency that correspond to the “peak”. The data output (fht_log_out) from the FFT execution module (I use FHT library) is in uint8 type. So what I have tried are compare and find the maximum value in this uint8 type of data, and then locate the bin number of the corresponding maximum value, and then by normalizing the bin number I should get the frequency.

However that will not work, and I guess the reason is that I couldn’t find the maximum value in a uint9 kind of datatype. What should I do?

Here is my code segment:

```
// Find the pike location
DoubleArray_FHT = DoubleArray_FHT/FHT_N;
uint16_t TempMax = 0; //temperary maximum
for (byte i=0;i<FHT_N/2;i++){
if(fht_log_out[i]>TempMax)
{
TempMax = fht_log_out[i];//find the maximum in fht_log_out
BinNumber = i;// position of the maximum
Speed = BinNumber*200/256;
```

Any suggestion will be much appreciated! Anyone?

Moderator edit: attempt to render code legible.