Compilation error: 'arduinoFFT' does not name a type; did you mean 'ArduinoFFT'?
want to use Fast Fourier Transform (FFT) to analyze the audio signals and then control the LEDs(ws2811)accordingly
Compilation error: 'arduinoFFT' does not name a type; did you mean 'ArduinoFFT'?
want to use Fast Fourier Transform (FFT) to analyze the audio signals and then control the LEDs(ws2811)accordingly
Welcome to the forum
Your topic has been moved to the Programming category of the forum
Please post the sketch that causes the error, using code tags when you do
In my experience this is the easiest way to tidy up the code and add the code tags
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
#include <FastLED.h>
#include <arduinoFFT.h>
#define LED_PIN 6
#define LED_COUNT 50 // Adjusted for 50 LEDs
#define LEFT_AUDIO_PIN A0
#define RIGHT_AUDIO_PIN A1
#define SAMPLES 256
#define SAMPLING_FREQUENCY 10000
CRGB leds[LED_COUNT];
arduinoFFT FFT = arduinoFFT();
void setup() {
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, LED_COUNT);
Serial.begin(9600);
FFT.begin(SAMPLES, SAMPLING_FREQUENCY);
}
void loop() {
double vReal[SAMPLES];
double vImag[SAMPLES];
for (int i = 0; i < SAMPLES; i++) {
// Read left and right audio signals
vReal[i] = analogRead(LEFT_AUDIO_PIN);
vImag[i] = analogRead(RIGHT_AUDIO_PIN);
delayMicroseconds(100); // Adjust delay for sampling frequency
}
FFT.Windowing(vReal, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
FFT.Windowing(vImag, SAMPLES, FFT_WIN_TYP_HAMMING, FFT_FORWARD);
FFT.Compute(vReal, vImag, SAMPLES, FFT_FORWARD);
FFT.ComplexToMagnitude(vReal, vImag, SAMPLES);
// Find dominant frequency or perform analysis on the spectrum
// Control LEDs based on the analyzed frequency or spectrum
FastLED.show();
}
@jassbhathal Please edit your post, select all of the code then click the < code > icon to add the code tags, then save your post
It is clearly understandable if you read any example code: even if the library is called "arduinoFFT", the object is "ArduinoFFT" with uppercase letter.
But I also must say that you haven't even studied the library (and examples) to understand how the constructor must be used, because that's not the correct way! Please take your time to study a bit any new library you want use before asking us.
Same thing happening to me,this is what appears when you change the first letter to uppercase so if anyone who isnt super condescending (but I´m desperate), can actually help I would be grateful.
Compilation error: invalid use of template-name 'ArduinoFFT' without an argument list
Welcome to the forum
Please post your full sketch that resuts in the error that you quote from