ESP32 Analog Contuous Read

I'm using Arduino IDE 2.3.6 for code on a Deneyap Mini v2.
Was able to compile, load script below and see serial monitor outputs for this project.
Put the script into a new project and when compiled gave the following error "Compilation error: 'adc_continuous_data_t' does not name a type"

Went back original project and recompiled it and it gave the same error " Compilation error: 'adc_continuous_data_t' does not name a type"

Don't think I had any updates between the two projects.

Uninstalled Arduino IDE 2.3.6 and reinstalled Arduino IDE 2.3.6

This was the output when the code was working;
4/12/25
02:55:35.330 -> Time passed 10, Current 2402545
02:55:35.330 ->
02:55:35.330 -> ADC PIN 1 data:
02:55:35.330 -> Avg raw value = 141
02:55:35.330 -> Avg millivolts value = 81
02:55:35.330 -> ADC PIN 2 data:
02:55:35.330 -> Avg raw value = 151
02:55:35.330 -> Avg millivolts value = 84
02:55:35.330 -> ADC PIN 3 data:
02:55:35.330 -> Avg raw value = 212
02:55:35.330 -> Avg millivolts value = 103
02:55:35.330 -> ADC PIN 4 data:
02:55:35.330 -> Avg raw value = 174
02:55:35.330 -> Avg millivolts value = 91
02:55:36.376 -> Time passed 10, Current 2403558

Any suggestions?

/* AnalogReadContinuousTestRev0.ino




*  Board: Deneyap Mini v2
*/


// Define how many conversion per pin will happen and reading the data will be and average of all conversions
#define CONVERSIONS_PER_PIN 5

// Declare array of ADC pins that will be used for ADC Continuous mode - ONLY ADC1 pins are supported
// Number of selected pins can be from 1 to ALL ADC1 pins.
#ifdef CONFIG_IDF_TARGET_ESP32
uint8_t adc_pins[] = { 36, 39, 34, 35 };  //some of ADC1 pins for ESP32
#else
uint8_t adc_pins[] = { 1, 2, 3, 4 };  //ADC1 common pins for ESP32S2/S3 + ESP32C3/C6 + ESP32H2
#endif

// Calculate how many pins are declared in the array - needed as input for the setup function of ADC Continuous
uint8_t adc_pins_count = sizeof(adc_pins) / sizeof(uint8_t);

// Flag which will be set in ISR when conversion is done
volatile bool adc_coversion_done = false;

// Result structure for ADC Continuous reading
adc_continuous_data_t *result = NULL;

// ISR Function that will be triggered when ADC conversion is done
void ARDUINO_ISR_ATTR adcComplete() {
  adc_coversion_done = true;
}

unsigned long previousMillis = 0;  // store the previous time
unsigned long currentMillis = 0;

void setup() {
  // Initialize serial communication at 115200 bits per second:
  Serial.begin(115200);

  // Optional for ESP32: Set the resolution to 9-12 bits (default is 12 bits)
  analogContinuousSetWidth(12);

  // Optional: Set different attenaution (default is ADC_11db)
  analogContinuousSetAtten(ADC_11db);

  // Setup ADC Continuous with following input:
  // array of pins, count of the pins, how many conversions per pin in one cycle will happen, sampling frequency, callback function
  analogContinuous(adc_pins, adc_pins_count, CONVERSIONS_PER_PIN, 20000, &adcComplete);

  // Start ADC Continuous conversions
  analogContinuousStart();
}

void loop() {
  currentMillis = millis();  // get the current time
  // Check if conversion is done and try to read data
  if (adc_coversion_done == true) {
    Serial.print("Time passed ");
      Serial.print(currentMillis - previousMillis);
      Serial.print(", Current  ");
      Serial.println(currentMillis); 
    // Set ISR flag back to false
    adc_coversion_done = false;
    // Read data from ADC
    if (analogContinuousRead(&result, 0)) {
      // Optional: Stop ADC Continuous conversions to have more time to process (print) the data
      analogContinuousStop();
      for (int i = 0; i < adc_pins_count; i++) {
        Serial.printf("\nADC PIN %d data:", result[i].pin);
        Serial.printf("\n   Avg raw value = %d", result[i].avg_read_raw);
        Serial.printf("\n   Avg millivolts value = %d", result[i].avg_read_mvolts);
      }
      Serial.printf("\n");

      // Delay for better readability of ADC data
      delay(1000);

      // Optional: If ADC was stopped, start ADC conversions and wait for callback function to set adc_coversion_done flag to true
      analogContinuousStart();
      previousMillis = millis();
    } else {
      Serial.println("Error occurred during reading data. Set Core Debug Level to error or lower for more information.");
    }
  } // End if (adc_coversion_done == true)
}

Possibly, missing a #include of a library, or .h file?

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming category of the forum

adc_continuous_data_t *result = NULL;

What is the data type of the adc_continuous_data_t variable ?

Was this line of code in the working sketch ?

Ask the OP?

Sorry, I thought that I was replying to his/her initial post. In fact, I am sure that I was !

Shows as a reply to me on my screen. Oh well. Carry on.

On mine too but I am certain that I replied to the original post. The forum software seems to think otherwise

1 Like

Another minor tear in the space/time continuum.

1 Like

I thought it would be "operation of the IDE" because the script complied and ran but would not compile again which is not programming.

The code original came from https://docs.espressif.com/projects/arduino-esp32/en/latest/api/adc.html
Yes, it was in the working code which is the code list here.

That structure is not defined in the code you have presented. One possibility is, there is a missing reference to another file that contains the definition. So.
Has the file changed?
Was there a second file in the same folder, either ??.ino or ??.h, that is now missing?

No, the file has not change, it compiled in the past, loaded onto the Deneyap Mini v2 and is still run when powered.
The compiler had no problem in the past, not sure why it rejects it now.
I'm wondering if 'adc_continuous_data_t' is or was part of the ESP32

What version of the ESP32 Arduino Core package are you using? It looks like adc_continuous_data_t is defined in v3.x, but not v2.x.

1 Like

Interesting that adc_continuous_data_t is not in v2.x, yet it compiled, loaded and runs in the past.
The ESP32 Arduino Core package that is causing the error and installed is version 3.2.0
Is there anyway that can display which versions of have been used, just wondering if an update happened between compiling and not compiling.

I don't have that version installed, but looking at its GitHub page, I see that adc_continuous_data_t is indeed defined in core V3.2.0. See "esp32-hal-adc.h" in your ESP32 installation. The code in your first post compiles for me with V3.0.7.

Something else must be wrong.

I see adc_continuous_data_t is defined in core V3.2.0 "esp32-hal-adc.h" but still error.
Uninstalled core V3.2.0 and installed core V3.0.7 and still get the same error.
What version of Arduino IDE are you using?

I installed Arduino IDE version 1.8.18 and the script compiled, loaded and is running on the Deneyap Mini v2

Looks like Arduino IDE 2.3.6 has a bug

Hi @reddogluna. I'm going to ask you to provide the full verbose output from a compilation of the sketch using Arduino IDE 2.3.6.


:red_exclamation_mark: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Open your sketch in Arduino IDE 2.3.6.
  2. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  3. Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
  4. Click the "OK" button.
    The "Preferences" dialog will close.
  5. Select Sketch > Verify/Compile from the Arduino IDE menus.
  6. Wait for the compilation to fail.
  7. You will see a "Compilation error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  8. Open a forum reply here by clicking the "Reply" button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the compilation output into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to post the output.

In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.

Click here for attachment instructions

  1. Open any text editor program.
  2. Paste the copied output into the text editor.
  3. Save the file in .txt format.
  4. Open a forum reply here by clicking the "Reply" button.
  5. Click the "Upload" icon (Upload icon) on the post composer toolbar:

    The "Open" dialog will open.
  6. Select the .txt file you saved from the "Open" dialog.
  7. Click the "Open" button.
    The dialog will close.
  8. Click the "Reply" button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.

verbose output during compile 4-24-25.txt (90.6 KB)