Code: Select all
adc2_config_channel_atten( ADC2_CHANNEL_9, ADC_ATTEN_DB_11 );
int read_raw;
while (true)
{
esp_err_t r = adc2_get_raw( ADC2_CHANNEL_9, ADC_WIDTH_12Bit, &read_raw);
if ( r == ESP_OK ) {
printf("%d\n", read_raw );
} else if ( r == ESP_ERR_TIMEOUT ) {
printf("ADC2 used by Wi-Fi.\n");
}
vTaskDelay(1000);
}