Thanks to your suggestions I get something with this code.

`#include "arduinoFFT.h"`

#include <math.h>

#define SAMPLES 128 //Must be a power of 2

#define SAMPLING_FREQUENCY 5000 //Hz, must be less than 10000 due to ADC

const double signalFrequency = 1000;

arduinoFFT FFT = arduinoFFT();

unsigned int sampling_period_us;

unsigned long microseconds;

double amplitude[SAMPLES];

double vReal[SAMPLES];

double vImag[SAMPLES];

double cycles = (((SAMPLES - 1) * signalFrequency) / SAMPLING_FREQUENCY);

void setup() {

Serial.begin(115200);

sampling_period_us = round(1000000 * (1.0 / SAMPLING_FREQUENCY));

}

void loop() {

int i;

//float amplitude[i];

/*SAMPLING*/

///////////////////////////////////////

/*SAMPLING*/

for (int i = 0; i < SAMPLES; i++)

{

microseconds = micros(); //Overflows after around 70 minutes!

// amplitude = analogRead(0);

amplitude[i] = analogRead(0);

//lesept

//vImag[i] = int8_t((amplitude[i] * (cos((i * (twoPi * cycles)) / SAMPLES))) / 2000.0);

//vReal[i] = int8_t((amplitude[i] * (sin((i * (twoPi * cycles)) / SAMPLES))) / 5000.0);

vImag[i] = int32_t((amplitude[i] * (cos((i * (twoPi * cycles)) / SAMPLES))) / 2000.0);

vReal[i] = int32_t((amplitude[i] * (sin((i * (twoPi * cycles)) / SAMPLES))) / 5000.0);

//johnwasser, pic sine

//vReal[i] = int8_t((amplitude * (sin((i * (twoPi * cycles)) / SAMPLES))) / 2.0);

// vImag[i] = int8_t((amplitude * (cos((i * (twoPi * cycles)) / SAMPLES))) / 2.0);

// vReal[i] = int8_t((2 * (sin((i * (twoPi * cycles)) / SAMPLES))) /2.0);

// vImag[i] = int8_t((2 * (cos((i * (twoPi * cycles)) / SAMPLES))) / 2.0);

while (micros() - microseconds < sampling_period_us)

{

}

}

///////////////////////////////////////////////

/*FFT*/

FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);

FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);

FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);

double peak = FFT.MajorPeak(vReal, SAMPLES, SAMPLING_FREQUENCY);

/*PRINT RESULTS*/

//Serial.println(peak); //Print out what frequency is the most dominant.

for (int i = 0; i < (SAMPLES / 2); i++)

{

/*View all these three lines in serial terminal to see which frequencies has which amplitudes*/

//Serial.print((i * 1.0 * SAMPLING_FREQUENCY) / SAMPLES, 1);

//Serial.print(" ");

Serial.println(vReal[i], 1); //View only this line in serial plotter to visualize the bins

}

}