Esp32s3 How to recycle the used ADC pin in the ESP-IDF

xynling
Posts: 2
Joined: Tue Mar 14, 2023 8:01 pm

Esp32s3 How to recycle the used ADC pin in the ESP-IDF

Postby xynling » Tue Mar 14, 2023 8:06 pm

Esp32s3 How to recycle the used ADC pin in the idf framework, for example, when I use gpio4 as the ADC pin, I need it to send low level after the ADC measurement, but the following code does not work. When using gpio_ reset_ pin(4); The restart will be triggered when the statement is commented out, but the following code will not take effect :shock:
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(ADC1_CHANNEL_3, ADC_ATTEN_DB_11);
int adc_val = adc1_get_raw(ADC1_CHANNEL_3);
ESP_LOGI(TAG, "adc_test");
gpio_reset_pin(4);
vTaskDelay(pdMS_TO_TICKS(1000));

ESP_LOGI(TAG, "poweroff");
gpio_set_direction(4, GPIO_MODE_OUTPUT);
gpio_set_level(4, 0);
vTaskDelay(pdMS_TO_TICKS(200));
gpio_set_level(4, 1);

Who is online

Users browsing this forum: No registered users and 143 guests