Sudden compilation errors?

So I’ve strung one of my 200 led strings into a 20x10 matrix, and I’ve been mucking around with spectrum analyser sketches…

I had one going, that used the FastLED_NeoMatrix, arduinoFFT, and EasyButton libraries, and I was playing around with it a bit, and then I flashed the ESP32 with some other sort of sketch for something else the other day. Then today, I load up the sketch I had working, and it’s throwing this error - Compilation error: ‘arduinoFFT’ does not name a type; did you mean ‘ArduinoFFT’?

WTF?

So I tried an example sketch for the arduinoFFT library; FFT_01. And it goes, Compilation error: ‘abscissa’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Seriously? Why would a small example sketch for a very popular library have a mistake in it? This just seems gratuitous.

Latest version of the Arduino IDE (2.3.2), libraries all updated, tried restarting my machine :face_with_diagonal_mouth:

2 Likes

Yo @Kimmo
Sounds super frustrating.
Check us some code and we’ll check it out.
Pix :heavy_heart_exclamation:

3 Likes

I think there is a case-sensitivity issue with the library name.

2 Likes

It’s only a warning; there might be no problem at all. Perhaps the compiler has been updated for stricter checking since the library was built, or perhaps you are just running with stricter checking settings than were used for the original build.

2 Likes

Here’s the example I’d imagine that should just work:

/*
  In this example, the Arduino simulates the sampling of a sinusoidal 1000 Hz
  signal with an amplitude of 100, sampled at 5000 Hz. Samples are stored
  inside the vReal array. The samples are windowed according to Hamming
  function. The FFT is computed using the windowed samples. Then the magnitudes
  of each of the frequencies that compose the signal are calculated. Finally,
  the frequency with the highest peak is obtained, being that the main frequency
  present in the signal.
*/

#include "arduinoFFT.h"

/*
These values can be changed in order to evaluate the functions
*/
const uint16_t samples = 64; //This value MUST ALWAYS be a power of 2
const double signalFrequency = 1000;
const double samplingFrequency = 5000;
const uint8_t amplitude = 100;

/*
These are the input and output vectors
Input vectors receive computed results from FFT
*/
double vReal[samples];
double vImag[samples];

/* Create FFT object */
ArduinoFFT<double> FFT = ArduinoFFT<double>(vReal, vImag, samples, samplingFrequency);

#define SCL_INDEX 0x00
#define SCL_TIME 0x01
#define SCL_FREQUENCY 0x02
#define SCL_PLOT 0x03

void setup()
{
  Serial.begin(115200);
  while(!Serial);
  Serial.println("Ready");
}

void loop()
{
  /* Build raw data */
  double ratio = twoPi * signalFrequency / samplingFrequency; // Fraction of a complete cycle stored at each sample (in radians)
  for (uint16_t i = 0; i < samples; i++)
  {
    vReal[i] = int8_t(amplitude * sin(i * ratio) / 2.0);/* Build data with positive and negative values*/
    //vReal[i] = uint8_t((amplitude * (sin(i * ratio) + 1.0)) / 2.0);/* Build data displaced on the Y axis to include only positive values*/
    vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
  }
  /* Print the results of the simulated sampling according to time */
  Serial.println("Data:");
  PrintVector(vReal, samples, SCL_TIME);
  FFT.windowing(FFTWindow::Hamming, FFTDirection::Forward);	/* Weigh data */
  Serial.println("Weighed data:");
  PrintVector(vReal, samples, SCL_TIME);
  FFT.compute(FFTDirection::Forward); /* Compute FFT */
  Serial.println("Computed Real values:");
  PrintVector(vReal, samples, SCL_INDEX);
  Serial.println("Computed Imaginary values:");
  PrintVector(vImag, samples, SCL_INDEX);
  FFT.complexToMagnitude(); /* Compute magnitudes */
  Serial.println("Computed magnitudes:");
  PrintVector(vReal, (samples >> 1), SCL_FREQUENCY);
  double x = FFT.majorPeak();
  Serial.println(x, 6);
  while(1); /* Run Once */
  // delay(2000); /* Repeat after delay */
}

void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType)
{
  for (uint16_t i = 0; i < bufferSize; i++)
  {
    double abscissa;
    /* Print abscissa value */
    switch (scaleType)
    {
      case SCL_INDEX:
        abscissa = (i * 1.0);
	break;
      case SCL_TIME:
        abscissa = ((i * 1.0) / samplingFrequency);
	break;
      case SCL_FREQUENCY:
        abscissa = ((i * 1.0 * samplingFrequency) / samples);
	break;
    }
    Serial.print(abscissa, 6);
    if(scaleType==SCL_FREQUENCY)
      Serial.print("Hz");
    Serial.print(" ");
    Serial.println(vData[i], 4);
  }
  Serial.println();
}

exit status 1

Compilation error: ‘abscissa’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

1 Like

A reasonable assumption, especially since in that above example there’s a capital A, except that the code didn’t change since the last time it worked, and if I change the code to match the suggestion, it spits out this other error:

exit status 1

Compilation error: invalid use of template-name ‘ArduinoFFT’ without an argument list

The original code:

// (Heavily) adapted from https://github.com/G6EJD/ESP32-8266-Audio-Spectrum-Display/blob/master/ESP32_Spectrum_Display_02.ino
// Adjusted to allow brightness changes on press+hold, Auto-cycle for 3 button presses within 2 seconds
// Edited to add Neomatrix support for easier compatibility with different layouts.

#include <FastLED_NeoMatrix.h>
#include <arduinoFFT.h>
#include <EasyButton.h>

#define SAMPLES         1024          // Must be a power of 2
#define SAMPLING_FREQ   40000         // Hz, must be 40000 or less due to ADC conversion time. Determines maximum frequency that can be analysed by the FFT Fmax=sampleF/2.
#define AMPLITUDE       2000          // Depending on your audio source level, you may need to alter this value. Can be used as a 'sensitivity' control.
#define AUDIO_IN_PIN    25            // Signal in on this pin
#define LED_PIN         15             // LED strip data
#define BTN_PIN         4             // Connect a push button to this pin to change patterns
#define LONG_PRESS_MS   200           // Number of ms to count as a long press
#define COLOR_ORDER     BGR           // If colours look wrong, play with this
#define CHIPSET         WS2812B       // LED strip type
#define MAX_MILLIAMPS   2000          // Careful with the amount of power here if running off USB port
const int BRIGHTNESS_SETTINGS[3] = {5, 70, 200};  // 3 Integer array for 3 brightness settings (based on pressing+holding BTN_PIN)
#define LED_VOLTS       5             // Usually 5 or 12
#define NUM_BANDS       10            // To change this, you will need to change the bunch of if statements describing the mapping from bins to bands
#define NOISE           500           // Used as a crude noise filter, values below this are ignored
const uint8_t kMatrixWidth = 20;                          // Matrix width
const uint8_t kMatrixHeight = 10;                         // Matrix height
#define NUM_LEDS       (kMatrixWidth * kMatrixHeight)     // Total number of LEDs
#define BAR_WIDTH      1 //(kMatrixWidth  / (NUM_BANDS - 1))  // If width >= 8 light 1 LED width per bar, >= 16 light 2 LEDs width bar etc
#define TOP            (kMatrixHeight - 0)                // Don't allow the bars to go offscreen
#define SERPENTINE     true                               // Set to false if you're LEDS are connected end to end, true if serpentine

// Sampling and FFT stuff
unsigned int sampling_period_us;
byte peak[] = {0,0,0,0,0,0,0,0,0,0};              // The length of these arrays must be >= NUM_BANDS
int oldBarHeights[] = {0,0,0,0,0,0,0,0,0,0};
int bandValues[] = {0,0,0,0,0,0,0,0,0,0};
double vReal[SAMPLES];
double vImag[SAMPLES];
unsigned long newTime;
arduinoFFT FFT = arduinoFFT(vReal, vImag, SAMPLES, SAMPLING_FREQ);

// Button stuff
int buttonPushCounter = 0;
bool autoChangePatterns = false;
EasyButton modeBtn(BTN_PIN);

// FastLED stuff
CRGB leds[NUM_LEDS];
DEFINE_GRADIENT_PALETTE( purple_gp ) {
  0,   0, 212, 255,   //blue
255, 179,   0, 255 }; //purple
DEFINE_GRADIENT_PALETTE( outrun_gp ) {
  0, 141,   0, 100,   //purple
127, 255, 192,   0,   //yellow
255,   0,   5, 255 };  //blue
DEFINE_GRADIENT_PALETTE( greenblue_gp ) {
  0,   0, 255,  60,   //green
 64,   0, 236, 255,   //cyan
128,   0,   5, 255,   //blue
192,   0, 236, 255,   //cyan
255,   0, 255,  60 }; //green
DEFINE_GRADIENT_PALETTE( redyellow_gp ) {
  0,   200, 200,  200,   //white
 64,   255, 218,    0,   //yellow
128,   231,   0,    0,   //red
192,   255, 218,    0,   //yellow
255,   200, 200,  200 }; //white
CRGBPalette16 purplePal = purple_gp;
CRGBPalette16 outrunPal = outrun_gp;
CRGBPalette16 greenbluePal = greenblue_gp;
CRGBPalette16 heatPal = redyellow_gp;
uint8_t colorTimer = 0;

// FastLED_NeoMaxtrix - see https://github.com/marcmerlin/FastLED_NeoMatrix for Tiled Matrixes, Zig-Zag and so forth
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(leds, kMatrixWidth, kMatrixHeight,
  NEO_MATRIX_TOP        + NEO_MATRIX_LEFT +
  NEO_MATRIX_COLUMNS       + NEO_MATRIX_ZIGZAG +
  NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS);

void setup() {
  Serial.begin(115200);
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
  FastLED.setMaxPowerInVoltsAndMilliamps(LED_VOLTS, MAX_MILLIAMPS);
  FastLED.setBrightness(BRIGHTNESS_SETTINGS[1]);
  FastLED.clear();

  modeBtn.begin();
  modeBtn.onPressed(changeMode);
  modeBtn.onPressedFor(LONG_PRESS_MS, brightnessButton);
  modeBtn.onSequence(3, 2000, startAutoMode);
  modeBtn.onSequence(5, 2000, brightnessOff);
  sampling_period_us = round(1000000 * (1.0 / SAMPLING_FREQ));
}

void changeMode() {
  Serial.println("Button pressed");
  if (FastLED.getBrightness() == 0) FastLED.setBrightness(BRIGHTNESS_SETTINGS[0]);  //Re-enable if lights are "off"
  autoChangePatterns = false;
  buttonPushCounter = (buttonPushCounter + 1) % 6;
}

void startAutoMode() {
  autoChangePatterns = true;
}

void brightnessButton() {
  if (FastLED.getBrightness() == BRIGHTNESS_SETTINGS[2])  FastLED.setBrightness(BRIGHTNESS_SETTINGS[0]);
  else if (FastLED.getBrightness() == BRIGHTNESS_SETTINGS[0]) FastLED.setBrightness(BRIGHTNESS_SETTINGS[1]);
  else if (FastLED.getBrightness() == BRIGHTNESS_SETTINGS[1]) FastLED.setBrightness(BRIGHTNESS_SETTINGS[2]);
  else if (FastLED.getBrightness() == 0) FastLED.setBrightness(BRIGHTNESS_SETTINGS[0]); //Re-enable if lights are "off"
}

void brightnessOff(){
  FastLED.setBrightness(0);  //Lights out
}

void loop() {

  // Don't clear screen if waterfall pattern, be sure to change this is you change the patterns / order
  if (buttonPushCounter != 5) FastLED.clear();

  modeBtn.read();

  // Reset bandValues[]
  for (int i = 0; i<NUM_BANDS; i++){
    bandValues[i] = 0;
  }

  // Sample the audio pin
  for (int i = 0; i < SAMPLES; i++) {
    newTime = micros();
    vReal[i] = analogRead(AUDIO_IN_PIN); // A conversion takes about 9.7uS on an ESP32
    vImag[i] = 0;
    while ((micros() - newTime) < sampling_period_us) { /* chill */ }
  }

  // Compute FFT
  FFT.DCRemoval();
  FFT.Windowing(FFT_WIN_TYP_HAMMING, FFT_FORWARD);
  FFT.Compute(FFT_FORWARD);
  FFT.ComplexToMagnitude();

  // Analyse FFT results
  for (int i = 2; i < (SAMPLES/2); i++){       // Don't use sample 0 and only first SAMPLES/2 are usable. Each array element represents a frequency bin and its value the amplitude.
    if (vReal[i] > NOISE) {                    // Add a crude noise filter

    //10 bands, 12kHz top band
    
      if (i<=4 )           bandValues[0]  += (int)vReal[i];
      if (i>4   && i<=8  ) bandValues[1]  += (int)vReal[i];
      if (i>8   && i<=16 ) bandValues[2]  += (int)vReal[i];
      if (i>16  && i<=32 ) bandValues[3]  += (int)vReal[i];
      if (i>32  && i<=64 ) bandValues[4]  += (int)vReal[i];
      if (i>64  && i<=100 ) bandValues[5]  += (int)vReal[i];
      if (i>100  && i<=140 ) bandValues[6]  += (int)vReal[i];
      if (i>140  && i<=160) bandValues[7]  += (int)vReal[i];
      if (i>160 && i<=170) bandValues[8]  += (int)vReal[i];
      if (i>170          ) bandValues[9]  += (int)vReal[i];

    /*//16 bands, 12kHz top band
      if (i<=2 )           bandValues[0]  += (int)vReal[i];
      if (i>2   && i<=3  ) bandValues[1]  += (int)vReal[i];
      if (i>3   && i<=5  ) bandValues[2]  += (int)vReal[i];
      if (i>5   && i<=7  ) bandValues[3]  += (int)vReal[i];
      if (i>7   && i<=9  ) bandValues[4]  += (int)vReal[i];
      if (i>9   && i<=13 ) bandValues[5]  += (int)vReal[i];
      if (i>13  && i<=18 ) bandValues[6]  += (int)vReal[i];
      if (i>18  && i<=25 ) bandValues[7]  += (int)vReal[i];
      if (i>25  && i<=36 ) bandValues[8]  += (int)vReal[i];
      if (i>36  && i<=50 ) bandValues[9]  += (int)vReal[i];
      if (i>50  && i<=69 ) bandValues[10] += (int)vReal[i];
      if (i>69  && i<=97 ) bandValues[11] += (int)vReal[i];
      if (i>97  && i<=135) bandValues[12] += (int)vReal[i];
      if (i>135 && i<=189) bandValues[13] += (int)vReal[i];
      if (i>189 && i<=264) bandValues[14] += (int)vReal[i];
      if (i>264          ) bandValues[15] += (int)vReal[i];*/
    }
  }

  // Process the FFT data into bar heights
  for (byte band = 0; band < NUM_BANDS; band++) {

    // Scale the bars for the display
    int barHeight = bandValues[band] / AMPLITUDE;
    if (barHeight > TOP) barHeight = TOP;

    // Small amount of averaging between frames
    barHeight = ((oldBarHeights[band] * 1) + barHeight) / 2;

    // Move peak up
    if (barHeight > peak[band]) {
      peak[band] = min(TOP, barHeight);
    }

    // Draw bars
    switch (buttonPushCounter) {
      case 0:
        rainbowBars(band, barHeight);
        break;
      case 1:
        // No bars on this one
        break;
      case 2:
        purpleBars(band, barHeight);
        break;
      case 3:
        centerBars(band, barHeight);
        break;
      case 4:
        changingBars(band, barHeight);
        break;
      case 5:
        waterfall(band);
        break;
    }

    // Draw peaks
    switch (buttonPushCounter) {
      case 0:
        whitePeak(band);
        break;
      case 1:
        outrunPeak(band);
        break;
      case 2:
        whitePeak(band);
        break;
      case 3:
        // No peaks
        break;
      case 4:
        // No peaks
        break;
      case 5:
        // No peaks
        break;
    }

    // Save oldBarHeights for averaging later
    oldBarHeights[band] = barHeight;
  }

  // Decay peak
  EVERY_N_MILLISECONDS(60) {
    for (byte band = 0; band < NUM_BANDS; band++)
      if (peak[band] > 0) peak[band] -= 1;
    colorTimer++;
  }

  // Used in some of the patterns
  EVERY_N_MILLISECONDS(10) {
    colorTimer++;
  }

  EVERY_N_SECONDS(10) {
    if (autoChangePatterns) buttonPushCounter = (buttonPushCounter + 1) % 6;
  }

  FastLED.show();
}

// PATTERNS BELOW //

void rainbowBars(int band, int barHeight) {
  int xStart = BAR_WIDTH * band;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    for (int y = TOP; y >= TOP - barHeight; y--) {
      matrix->drawPixel(x, y, CHSV((x / BAR_WIDTH) * (255 / NUM_BANDS), 255, 255));
    }
  }
}

void purpleBars(int band, int barHeight) {
  int xStart = BAR_WIDTH * band;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    for (int y = TOP; y >= TOP - barHeight; y--) {
      matrix->drawPixel(x, y, ColorFromPalette(purplePal, y * (255 / (barHeight + 1))));
    }
  }
}

void changingBars(int band, int barHeight) {
  int xStart = BAR_WIDTH * band;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    for (int y = TOP; y >= TOP - barHeight; y--) {
      matrix->drawPixel(x, y, CHSV(y * (255 / kMatrixHeight) + colorTimer, 255, 255));
    }
  }
}

void centerBars(int band, int barHeight) {
  int xStart = BAR_WIDTH * band;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    if (barHeight % 2 == 0) barHeight--;
    int yStart = ((kMatrixHeight - barHeight) / 2 );
    for (int y = yStart; y <= (yStart + barHeight); y++) {
      int colorIndex = constrain((y - yStart) * (255 / barHeight), 0, 255);
      matrix->drawPixel(x, y, ColorFromPalette(heatPal, colorIndex));
    }
  }
}

void whitePeak(int band) {
  int xStart = BAR_WIDTH * band;
  int peakHeight = TOP - peak[band] - 1;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    matrix->drawPixel(x, peakHeight, CHSV(0,0,255));
  }
}

void outrunPeak(int band) {
  int xStart = BAR_WIDTH * band;
  int peakHeight = TOP - peak[band] - 1;
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    matrix->drawPixel(x, peakHeight, ColorFromPalette(outrunPal, peakHeight * (255 / kMatrixHeight)));
  }
}

void waterfall(int band) {
  int xStart = BAR_WIDTH * band;
  double highestBandValue = 60000;        // Set this to calibrate your waterfall

  // Draw bottom line
  for (int x = xStart; x < xStart + BAR_WIDTH; x++) {
    matrix->drawPixel(x, 0, CHSV(constrain(map(bandValues[band],0,highestBandValue,160,0),0,160), 255, 255));
  }

  // Move screen up starting at 2nd row from top
  if (band == NUM_BANDS - 1){
    for (int y = kMatrixHeight - 2; y >= 0; y--) {
      for (int x = 0; x < kMatrixWidth; x++) {
        int pixelIndexY = matrix->XY(x, y + 1);
        int pixelIndex = matrix->XY(x, y);
        leds[pixelIndexY] = leds[pixelIndex];
      }
    }
  }
}

exit status 1

Compilation error: ‘arduinoFFT’ does not name a type; did you mean ‘ArduinoFFT’?

There’s also this other error it manages to get past before halting at that last one:

C:\Users\Me\Documents\Arduino\crap.spectro\crap.spectro.ino: In function ‘void loop()’:
C:\Users\Me\Documents\Arduino\crap.spectro\crap.spectro.ino:198:3: error: ‘FFT’ was not declared in this scope
FFT.DCRemoval();
^~~

To my extremely untrained eye, this seems to suggest the compiler isn’t finding the FFT library?
Come to think of it, the thing that has changed since it worked was that I saved the sketch and loaded it after a restart. Is there something wrong with the path, maybe? Is that period in the name a problem perhaps?

1 Like

Had a look in preferences/settings, and changed compiler warnings from all to none, which actually allowed me to flash the FFT_01 example, but there’s nothing coming the serial monitor, and if I try to flash the spectro sketch it still spits out the same error :frowning:

1 Like

If you think it might be a problem, or if you just want to get rid of the error, then initialize it to a suitable value.

1 Like

I just want to be able flash the sketch again. Unfortunately I’m way too much of a hopeless noob to be able to make use of this advice. Could you be more explicit?

1 Like

You will find a line where the variable is declared:

double abscissa;

Change that to include the initialisation:

double abscissa = -1;

This is a sketch error, not a library error. Note that I have no idea whether or not -1 is a suitable initializer - that depends on the logic of your sketch. But since the initial value apparently never gets used for anything, the value doesn’t matter. It just needs to be a number and not some random junk that hust happened to be in memory.

2 Likes

Oh, you’re referring to the FFT example. Tried your suggestion, but just like before, it seemed to flash successfully but nothing coming through the serial monitor. Anyway, I was just trying that example sketch to see if it could give me any clues as to why the spectro sketch stopped working, but that just led to even more confusion…

Any idea how to address this error from the spectro code?

exit status 1

Compilation error: ‘arduinoFFT’ does not name a type; did you mean ‘ArduinoFFT’?

Or maybe this one, if that suggestion is correct?

exit status 1

Compilation error: invalid use of template-name ‘ArduinoFFT’ without an argument list

1 Like

What was the result when you tried the suggested change? The object is ‘ArduinoFFT’, although the author’s spelling is a bit erratic.

If that doesn’t fix it you should indicate the sketch (if it’s an example) or show the code and indicate the line at which the error is occurring. What is ‘spectro code’? Is it the code you posted above?

2 Likes

Yeah, I’m talking about the code I posted here: Sudden compilation errors? - #6 by Kimmo - it’s taken from here.

When I tried the change I got this error:

exit status 1

Compilation error: invalid use of template-name ‘ArduinoFFT’ without an argument list

With the code in its original form, which worked before I saved it, flashed something else, restarted my machine, loaded the sketch without changing anything and tried to flash it again, and it spat out the ‘does not name a type’ error you just quoted, it highlighted these two lines:

In the ‘Sampling and FFT stuff’ section:

arduinoFFT FFT = arduinoFFT(vReal, vImag, SAMPLES, SAMPLING_FREQ);

And in the ‘Compute FFT’ section:

FFT.DCRemoval();

And if capitalise the A as suggested, it does the ‘without an argument list’ error and highlights the same two lines.

Had another look at the GitHub page I got the sketch from; there was this:

At the time of writing, the library manager version arduinoFFT has a bug which prevents DCRemoval() from working, so download it from the GitHub repository and install it from a zip file.

Fairly sure I did that in the first place, but did that again in case I’d updated it with the buggy one… and it changes nothing.

1 Like

So I assume that ‘Compilation error: ‘arduinoFFT’ does not name a type; did you mean ‘ArduinoFFT’?’ has been fixed by changing the spelling.

I believe your first error now is:

C:\Users\_________\AppData\Local\Temp\.arduinoIDE-unsaved2024210-10252-2nslhh.kt2zr\spectro\spectro.ino:38:1: error: invalid use of template-name 'ArduinoFFT' without an argument list
 ArduinoFFT FFT = ArduinoFFT(vReal, vImag, SAMPLES, SAMPLING_FREQ);

That is, line 38 is wrong. I think it ought to be
ArduinoFFT<double> FFT = ArduinoFFT<double>(vReal, vImag, SAMPLES, SAMPLING_FREQ);

and the second error is:

C:\Users\________\AppData\Local\Temp\.arduinoIDE-unsaved2024210-10252-2nslhh.kt2zr\spectro\spectro:136:7: error: 'class ArduinoFFT<double>' has no member named 'DCRemoval'; did you mean 'dcRemoval'?
   FFT.DCRemoval();

So that requires a change of line 136 to:
FFT.dcRemoval();

You will need to make similar changes at line 137 (‘windowing’), 138 (‘compute’) and 139 (complexToMagnitude’).

Then your code compiles clean. I don’t know what you are expecting this code to do, but it might now work (except for SPI, which you haven’t yet defined pins for).

3 Likes

Woohoo! Thanks so much! Is there any point asking how you found the errors, or would my noobness preclude an answer being useful?

It’s not my code - I couldn’t begin to write something like this. I found it on GitHub (linked above), when looking for some spectrum analyser code to hopefully form the basis for some music visualisation ideas I have in mind, if I can figure out enough to pull the bare essentials from it and repurpose them.

Ideally, I’d research various FFT libraries and build my own thing from scratch, but despite being fairly smart I just can’t seem to stop my eyes rapidly glazing over when I try to get my head around this stuff; the learning curve is so steep and I just can’t seem to get a toehold in that wall. Been banging my head on it for a while now, but I haven’t quite given up yet… I’m annoyed that I didn’t pursue programming and maths a lot further 35-40 years ago.

2 Likes

The first fix is simply copied from an example that works.

The others just followed the suggestion for the alternate spelling. You may have to try compiling several times in order to get all the errors reported.

2 Likes

Nice one @Jeff105671 :+1: