ESP IDF gives this warnig:
Code: Select all
ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`
Code: Select all
#include "driver/adc.h" //ADC
#include "esp_adc/adc_oneshot.h"
#include "esp_adc/adc_continuous.h"
#include "esp_adc_cal.h" //ADC
#include "esp_adc/adc_cali.h"
Code: Select all
static esp_adc_cal_characteristics_t adc1_chars;
//uint16_t voltage;
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_DEFAULT, 0, &adc1_chars);
ESP_ERROR_CHECK(adc1_config_width(ADC_WIDTH_BIT_DEFAULT));
ESP_ERROR_CHECK(adc1_config_channel_atten(ADC1_CHANNEL_6, ADC_ATTEN_DB_11));
pil_voltaji = esp_adc_cal_raw_to_voltage(adc1_get_raw(ADC1_CHANNEL_6), &adc1_chars);