How to get digital input from ADC pins?
Posted: Mon Nov 09, 2020 8:25 pm
I would like to use my pins, which are able to do ADC1, as general GPIO pins to read digital values. This is somehow not possible using this config:
Do I need to deactivate ADC somehow? What is the reason, why I cannot read their digital values with:
Code: Select all
gpio_config_t io_conf;
// configure interrupt pins
// set as input mode
io_conf.mode = GPIO_MODE_INPUT;
// interrupt
io_conf.intr_type = GPIO_INTR_DISABLE;
// bit mask of the pins
io_conf.pin_bit_mask = (BIT(39) | BIT(36) | BIT(34));
// dis pull-down mode
io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
// disable pull-up mode
io_conf.pull_up_en = GPIO_PULLUP_DISABLE;
esp_err_t ret_gpio = gpio_config(&io_conf);
Code: Select all
gpio_get_level(36);
//...