The code to set the esp32/arduino code to set the analog attenuation doesn't seem to work. Can anyone say how its supposed to be done? Or is there some bug in the SDK?
Code is here: https://github.com/espressif/arduino-es ... -adc.c#L69
Issue here: https://github.com/espressif/arduino-esp32/issues/87
Thanks for any help
How to set the analog attenuation?
Re: How to set the analog attenuation?
Code: Select all
adc1_config_width(ADC_WIDTH_12Bit);//config adc1 width
adc1_pad_init(ADC1_CHANNEL_6);
adc1_config_channel_atten(ADC1_CHANNEL_6,ADC_ATTEN_0db);
int val=adc1_get_voltage(ADC1_CHANNEL_6);
adc1_config_channel_atten(ADC1_CHANNEL_6,ADC_ATTEN_11db);
int val2=adc1_get_voltage(ADC1_CHANNEL_6);
printf("ADC1 CH6 value: %d @ 0db, %d @ 11db\n", val, val2);
fflush(stdout);
Code: Select all
ADC1 CH6 value: 1828 @ 0db, 448 @ 11db
-
- Posts: 21
- Joined: Mon Dec 21, 2015 9:30 am
-
- Posts: 9
- Joined: Tue Dec 20, 2016 7:24 am
Re: How to set the analog attenuation?
I have a question.
In order to call this function - adc1_pad_init(...),
what header file did you include?
In order to call this function - adc1_pad_init(...),
what header file did you include?
Who is online
Users browsing this forum: No registered users and 248 guests