Turning potentiometer crashes esp32
Posted: Fri Feb 24, 2023 10:52 am
Hello there !
I'm trying to use a potentiometer STEC12E07 but each time I turn it, my Esp32 crashes.
I did not find a pin layout for this potentiometer but it's my understanding that the middle pin should be connected to my esp's analog input and that it should not matter which of the outer pins is connected to GDN or 3v3 / 5v.
I tried every combinations and did not manage to make it work, the only difference was that the default value was either 0 or 4095 but it still crashes when turning. I tried turning it without reading the value in the code but it crashes anyway so i'm guessing it has to do with my wiring/hardware (which is were my knowledge ends ahah)
Does someone know what I could be doing wrong ?
Below is how I set up my pin
.
Thanks !
I'm trying to use a potentiometer STEC12E07 but each time I turn it, my Esp32 crashes.
I did not find a pin layout for this potentiometer but it's my understanding that the middle pin should be connected to my esp's analog input and that it should not matter which of the outer pins is connected to GDN or 3v3 / 5v.
I tried every combinations and did not manage to make it work, the only difference was that the default value was either 0 or 4095 but it still crashes when turning. I tried turning it without reading the value in the code but it crashes anyway so i'm guessing it has to do with my wiring/hardware (which is were my knowledge ends ahah)
Does someone know what I could be doing wrong ?
Below is how I set up my pin
- adc1_config_width(ADC_WIDTH_BIT_12);
- adc1_config_channel_atten(ADC1_CHANNEL_1, ADC_ATTEN_11db); // ADC1_CHANNEL_1 (on pin 37)
- adc1_get_raw(ADC1_CHANNEL_1); // Reads value as intended
Thanks !